Welcome, Guest. Please login or register.


Author Topic: ScoreTrack, Vilmos Kopácsy MIDI attempt (Read 25658 times)

Offline TMTLOGIC

  • Beginner
  • *
  • Posts: 42
  • Country: nl
    • www.tmtlogic.com
Re: ScoreTrack, Vilmos Kopácsy MIDI attempt
« Reply #60 on: 2020.February.27. 08:03:20 »
it is possible on the real SE-ONE.
This option will also come later for the SF3.
 just have to wait. because the SF3 must then be reconfigured.
WWW.TMTLOGIC.COM

Offline gflorez

  • EP addict
  • *
  • Posts: 3614
  • Country: es
    • Támogató Támogató
Re: ScoreTrack, Vilmos Kopácsy MIDI attempt
« Reply #61 on: 2020.February.27. 08:08:47 »
Ok, yes,.... The tests are being made on the SE-ONE, to not disturb SF3 development, but all the midi stuff will be incorporated at the end to the SE-ONE the SF3 has inside. Is for that I am naming the two cards indistinctly.
« Last Edit: 2020.February.27. 09:32:51 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3614
  • Country: es
    • Támogató Támogató
Re: ScoreTrack, Vilmos Kopácsy MIDI attempt
« Reply #62 on: 2020.March.17. 12:14:08 »
Questions, aren't they the fuel that drives us humans?

----

I don't know from where to start, because I must return to some facts that I explained on the first commentary of this thread.

I think that the Midi interface that has arrived to our hands after so long time was made for the cartridge port for one very good reason. It was always an underused expansion port, out of being the place to put the necessary Basic Rom cartridge.

Probably the main reason for the unknown Jefrey(the name of the Rom writer and probably real developer) was to offer an interface that could be connected to all Enterprises, independently of the other expansions connected at the right side of the computer. The same objective than guided Szörg to put the SD reader there.  

But it is a very limited port to put devices, because the signals that arrive to it are oriented only to manage memory. This problem has been excellently solved in the case of the SD reader, using a memory zone as the interchange gate to the SD content.

On the Midi interface they did some similar, the two necessary ports where paginated on memory positions BFF8 and BFF9, on segment 7 put on page 03. The Rom is 32KB wide, and is placed on the 06 and 07 segments, allowing the cartridge to still hold copies of the language Rom on 04 and Basic Rom on 05 segments.

I have found that almost all Midi interfaces of that era made for MSX, BBC, CPC, PCW, Spectrum, used the same UART chip, the MC68B50. This chip doesn't have internally a lot of baud-rates to select, only 3 but related to the external oscillator used(1:1, 1:16, and 1:64). The 3 variants of the chip are the 1, 1.5 and 2Mhz versions, and the several Midi interface makers always selected the MC68B50 because its 2MH oscillator frequency, on the third selection, gives exactly the Midi baud-rate: 2.000.000/64=31250. Then only remains to select the serial protocol, 8bit and 1 stop bit and the chip has been configured.

It has 4 x 8 bit registers, Control(write), Status(read), Transmit Data(write) and Receive Data(read), and usually the interface makers joint all on only 2 ports, Control/Status and Data. Control is only used for initialisation, and is where we define the baud-rate and serial protocol.

  [ Guests cannot view attachments ]

Bits 5, 6 and 7 are used for interrupts, not applicable on the Cartridge Bus. They will go as Zeros.

Then you can see that  the initialisation is well defined, first we reset the chip writing 03h(00000011b) on the Control register, and then we write 16h(00010110d, 22d), this is, select 1:64 frequency and 8bit word with 1 stop bit.

Now, let's see what happens on the ScoreTrack Rom( I know the position because it was where IstvanV modified the Rom to work on the emulator):

Code: [Select]
*C146  32 F8 BF     LD    (BFF8), A     ; A arrives here with 00000111, perfect to reset the chip
  C149  3E 16        LD    A, 16h        ; 00010110 sets 1:64 frequency, 8 bit, 1 stop bit
  C14B  32 F8 BF     LD    (BFF8), A

Not needing any control except erasing the emulator Midi buffers, IstvanV modified it as this:

Code: [Select]
*C146  00     NOP
  C147  00     NOP
  C148  00     NOP
  C149  00     NOP
  C14A  00     NOP
  C14B  AF           XOR   A
  C14C  D3 F6        OUT   (F6), A       ; a Zero clears out buffer

To transmit data, the chip has the Status register, that has to be watched by the processor to know when there is data to receive or when it can send.  The Receive register is the bit 0, and the Send register is bit 1. The rest of bits are not important here.

On the ScoreTrack Rom there is only Midi OUT because the program is unfinished:

Code: [Select]
*DCB6  3A F8 BF     LD    A, (BFF8)
  DCB9  CB 4F        BIT   1, A         ; bit 1 marks if the data has been send
  DCBB  28 F9        JR    Z, DCB6
  DCBD  F1           POP   AF
  DCBE  32 F9 BF     LD    (BFF9), A    ;write the Midi OUT buffer

IstvanV modified it as this:

Code: [Select]
*DCB6  00           NOP
  DCB7  DB F6        IN    A, (F6)
  DCB9  CB 77        BIT   6, A          ; Send bit
  DCBB  20 FA        JR    NZ, DCB7
  DCBD  F1           POP   AF
  DCBE  D3 F7        OUT   (F7), A       ;Midi OUT
  DCC0  00           NOP


And then, here come my questions:

Why has made IstvanV so drastic changes to the code? Where they necessary? Some of you can contact him?

Because, we have to decide NOW if we must follow his changes, and remain compatible with the EP emulator and the Midi utilities, or on the contrary, emulate correctly the MC68B50, that will allow further development of the ScoreTrack program, share the chip emulation on the other computers that are supported by the  SF3, and probably we will have the opportunity to see easier sequencer conversions from other platforms that use the same chip, like CPC, even MSX.

Edit: if not evident, I want to mark the things that have been changed and apply or not apply to a good MC68B50 emulation:

-He has substituted the memory paginated ports for real unused ports. Good.
-Instead of the sequence 03h,16h written on the Control register for the chip initialisation he has opted to only write a Zero. Bad.
-On the Status byte, the Receive and Transmit bits have been changed from 0 and 1 bits to the 7 and 6 bits. Bad.
-The values of the bits inside the status byte has been negated, as you can see on the conditional jump. Bad.
« Last Edit: 2020.March.17. 21:24:16 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3614
  • Country: es
    • Támogató Támogató
Re: ScoreTrack, Vilmos Kopácsy MIDI attempt
« Reply #63 on: 2020.March.19. 11:48:21 »
I propose to make some changes on the Midi emulation(MC68B50), both on the EP128emu and on the SF3, and then on the ScoreTrack Rom:

Code: [Select]
First modification: Control Register initialisation.
 *C146  3E 03        LD    A, 3          ; 00000011, resets the MC68B50 chip, clears EP128emu and SF3 Midi buffers
  C148  D3 21        OUT   (21), A      
  C14A  3E 16        LD    A, 16h        ; 00010110 sets 1:64 frequency, 8 bit, 1 stop bit, EP128emu and SF3 IGNORE THIS!
  C14C  D3 21        OUT   (21), A       ; Future use: bits 5 and 6 = Transmit interrupt, bit 7 = Receive interrupt

And

Code: [Select]
Second modification: Midi OUT.
 *DCB6  00           NOP
  DCB7  DB 21        IN    A, (21)
  DCB9  CB 4F        BIT   1, A          ; bit 1 set marks if the data has been sent, bit 2 the same on receiving
  DCBB  28 FA        JR    Z, DCB7
  DCBD  F1           POP   AF
  DCBE  D3 22        OUT   (22), A       ; write the Midi OUT buffer
  DCC0  00           NOP

If the use of  21h and 22h ports on the EP128emu MIDI emulation is a problem, SF3 can also decode the F6h and F7h ports.

The SF3 will use 512Bytes on each FIFO buffer, IN and OUT.

On the test with the SE-ONE cartridge, the Midi output(the song being played) is unchanged by the Z80 frequency, because the output is managed by the emulated Midi interface.
« Last Edit: 2020.March.19. 11:52:42 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3614
  • Country: es
    • Támogató Támogató
Re: ScoreTrack, Vilmos Kopácsy MIDI attempt
« Reply #64 on: 2020.March.19. 16:59:52 »
Sorry again.... Geco has explained me that IstvanV created his emulated Midi interface before studying the ScoreTrack Rom, so he adapted the Rom to HIS working protocol.

Offline gflorez

  • EP addict
  • *
  • Posts: 3614
  • Country: es
    • Támogató Támogató
Re: ScoreTrack, Vilmos Kopácsy MIDI attempt
« Reply #65 on: 2020.September.05. 18:54:04 »
Great news! Geco is modest to announce it as a great release, but he has fixed the ScoreTrack Rom to work from any segment on the 4MB memory range, not only 06-07 on the cartridge area.

He also has fixed other errors on the Rom, like allow the use of language Roms or scan for available massive storage drives.

Now the Rom works both on the Emulator and on the SF3 MIDI OUTs, and of course also on DAVE.

Download the needed files from the first messages on this thread. DAVE.ENV must be on the default directory when the Rom is launched with the :ST command + Enter.