Porting ProTrack to SDCC

Door jepmsx

Expert (109)

afbeelding van jepmsx

04-11-2021, 07:04

Hello!

I want to compose musics for MSX-Music in a tracker so that later I can use them for my programs in SDCC. I have not seen any application that does it, but I have discovered that ProTrack has a small program in basic that loads the songs. I am trying to port it to SDCC using Fusion-C but I can't.

The program in basic loads a binary in memory, uses a menu in basic to select the songs, loads the song file by accessing the same binary in memory and then plays it.

I have managed to load the program's binary into memory and write the song to be played using Fusion-C, and then going to basic and executing the routine in binary to load the song file and reproduce the sound.

I have tried to do the same using SDCC and I can't. I have changed the addresses from Basic DOS (0xf37d) to MSX-DOS (0x0005). Debugging I have seen that when you try to load the song from disk to save it in memory, after the first block read, when you try to read the second, the memory changes completely. The destination block to load the song is 0xc900. My intuition is that it changes the mapping from Basic to DOS, but I haven't been able to figure out why.

Any help is welcome

Aangemeld of registreer om reacties te plaatsen

Van ToriHino

Paladin (739)

afbeelding van ToriHino

04-11-2021, 20:27

Hi,

It's a bit hard to indicate what exactly is going wrong without the sources. Note that when using the BDOS commands (by calling 0x005) in most cases the registers after returning are changed, so make sure you load them with the correct value when trying to load the next block. The memory should not be a problem, as long as you use a free part of the memory (so not over your own program Tongue or any important system variables, usually located on the top part of the memory ).

Note: to see what exactly the calls are doing you can check this page as a reference (it's for MSX-DOS 2, but also contains the DOS1 calls).

Van jepmsx

Expert (109)

afbeelding van jepmsx

04-11-2021, 22:48

Thanks ToriHino for your hints.

I thought that the basic calls 0xF37D and BDOS calls 0x0005 modified the same registers, I will check if they differ.

By the way, ToriHino, my object is to play protrack files in MSX-Music (FM-Pac). I've seen that your great application, Roboplay, does that for OPL4. Maybe it would be easier for me to adapt your C code to be used for MSX-Music, rather than quarrel with old assembler code. I've been looking at the roboplay code, and I think that I should use pro.c that reads the file format in the protracker file, and replace the calls to OPL4 by the FM-Pac ones. Are much different to program the FM part of Moonsound vs FM-Pac?