Project : convert yamaha YMxxx FM to saturn scsp FM

vbt

Staff member
I posted assembly source for the demo that used it here: http://www.hyakushiki.net/thedung.zip

But at the time (2013) it didn't work in any emulator, only by transferring it to the Saturn with Saturn USB. Is there an emulator that handles FM sound now? If so then I could try to make a simpler program to demonstrate FM sound.
Congrats for this demo, i'll try to recompile it and test it :) nobody here knew you did such work including a FM driver !
 

DamageX

New Member
I just found out that KbMedia player with AOSSF plugin can handle SCSP FM synth. I thought it didn't because last time I tried to make an .SSF it didn't work right for some reason. Go figure.

So I put together a quick and dirty YM-2203 player using my compiler. It's woefully incomplete but it sounds like FM when played in KbM or using Saturn USB.


edit: re-uploaded the archive because a couple files were missing (oops)
 
Last edited:
  • Wow
Reactions: vbt

DamageX

New Member
Here is a preliminary release of the (dual) YM-2203 player for Saturn, if anyone wants to try it.

This is a demonstration program. Press A to start playing a VGM, B to stop, C to play the other VGM. Up/down/left/right shows different register dumps on the screen (OPN or SCSP). The 1943 arcade track uses two OPNs, but doesn't use the SSG portion so I don't know if both of those are working. The noise generator is not emulated in any case.

This is the bare 68K driver. The sequence for starting a VGM is like this:
1) load driver at $5A00000
2) wait until the word at $25A0010C is 0 (this is the status word, 1 means busy)
3) read the dword at $25A00100 to find out the end address of the driver. Be sure to add $5A00000 to obtain the SH2 address.
4) write a VGM file to a free area in sound RAM (after the address calculated in step 3)
5) write the address (dword) of the VGM file to $5A00104 (subtract $5A00000 or mask off the upper bits first so it becomes a 68000 address)
6) write a word=1 to $5A00108

to stop: wait for the status word, then write a word=2 to $5A00108

Hopefully I got the instructions correct :) The source code is also here, of course it is written in NOWUT
 

vbt

Staff member
1583682490725.png

1943 is on the way, next step is using your VGM driver

EDIT : driver loaded :

1583699536552.png
 
Last edited:

vbt

Staff member
I did that :
Code:
//-------------------------------------------------------------------------------------------------------------------------------------
void DrvInitDamageXsound()
{
// init controller port
    *(UINT8 *)(0x2010007F)=0;
    *(UINT8 *)(0x2010007D)=3;
    *(UINT8 *)(0x20100079)=96;
    *(UINT8 *)(0x2010007B)=96;

// turn off the 68000
    *(UINT8 *)(0x2010001F)=7;
    for(int w=0;w<500;w++)
    {
        asm("nop\n"); // waste time
    }
    *(UINT16 *)(0x5B00400)=0x20F;

    for(int w=0;w<500;w++)
    {
        asm("nop\n"); // waste time
    }

    *(UINT16 *)(0x5B00402)=0x3F;

    for(int w=0;w<500;w++)
    {
        asm("nop\n"); // waste time
    }

    GFS_Load(GFS_NameToId("VGM68.BIN"),0,(void *)0x5A00000,4640);

// turn on the 68000
    *(UINT8 *)(0x2010001F)=6;

    while(*(UINT16 *)(0x25A0010C)!=0)
    {
        for(int w=0;w<500;w++)
        {
            asm("nop\n"); // waste time
        }
    }

    UINT32 end = *(UINT32 *)(0x25A00100);

    GFS_Load(GFS_NameToId("02.VGM"),0,(void *)(0x5A00000+end),14952);

//   memcpy((UINT16 *)(0x25A00104),(UINT16 *)(0x25A00100),sizeof(UINT16));//
*(UINT32 *)(0x25A00104)=end;
    *(UINT16 *)(0x25A00108)=1;
and it works !!! but it doesn't play all
super good job @DamageX !
 
Last edited:

vbt

Staff member
The other VGM files were the same indeed. I couldn't reproduce any problems. Are you loading them all at 4-byte aligned boundaries?

How about this build?
This one is working well, now i think, in some cases it stops because i don't have the sfx, i continue on 1943, we must beat capcom generations

Should i do a version of Rockin'-b Sound player with your Driver ?

with vgm,mdx support

1584747745380.png
 
Last edited:

vbt

Staff member
here is first beta, there are still many bugs but i've fixed some issues from the original program.
There is not yet a good switch between drivers. VGM flies play well, i can't play MOD & MDX yet.

source code is here :

 

Attachments

DamageX

New Member
Code:
251	        case PLAYVGM_MENU_PLAY:
252				if(sndSlots[slot].playing == 0) {
253				*(Uint16 *)(0x25A00108)=1; // start				
254					sndSlots[slot].playing = 1;
255					sndSlots[slot].frame = 0;
256				}   
257	            return;
This part needs to use 1, 3, or 4 depending on VGM, MDX, or MOD.
Code:
261				*(Uint16 *)(0x25A00108)= 2; // stop
262				sndSlots[slot].playing = 0;
263				Uint32 msk;
264	
265				msk = get_imask();
266				set_imask(15);
267				
268				while(*(Uint16 *)(0x25A0010C)!=0)
269				{
270					for(int w=0;w<500;w++)
271					{
272						asm("nop\n"); // waste time
273					}
274				}
Try changing 0x25A0010C to 0x25A00108 instead. (Only test 10C after loading the driver and turning on the 68000.) And send the stop command before you load the data from CD...
Hope this helps
 
Top