Odd SPC music loading in the SGB game Beach Volleyball
Posted: Fri Aug 02, 2019 5:04 am
I'm analyzing the Super Gameboy game Beach Volleyball because unlike most SGB games, it's using the SPC to play music. It's also interesting because it doesn't use the SGB command SOU_TRN to transfer the data. Instead it transfers code to the SNES which it calls to load the music. After the usual SGB hotpatch it transfers some more stuff to SNES RAM:
This code doesn't appear in any other games.
Disassembled, the code looks like this:
The code then calls a routine in the SGB BIOS whose location differs between the ROM revisions. This routine seems to load data from the SGB buffer and write it to the APU. Specifically, the display contents are hidden with the MASK_EN command as usual when doing a SGB transfer, then data is presented through VRAM and a JUMP command is executed to the location of the routine that was previously copied. Lastly the music is started using a SOUND command.
Before diving deeper into this, can anyone think of a reason why SOU_TRN would not be sufficient for transferring music data to the SPC?
Code: Select all
1 0F DATA_SND 79.00.18.00 0B.A9.01.8D 00.42.AF.DB FF.00.F0.05
1 0F DATA_SND 79.0B.18.00 0B.20.73.C5 80.03.20.76 C5.A9.31.8D
1 0F DATA_SND 79.16.18.00 03.00.42.60 00.00.00.00 00.00.00.00
Disassembled, the code looks like this:
Code: Select all
0000:1800 A9 01 mov a,01
0000:1802 8D 00 42 mov [4200],a ; Disable interrupts temporarily
0000:1805 AF DB FF 00 mov a,[far 00FFDB] ; Load SGB ROM version
0000:1809 F0 05 jz 1810
0000:180B 20 73 C5 call C573 ; Call if SGB v1
0000:180E 80 03 jr8 1813
0000:1810 20 76 C5 call C576 ; Call if SGB v0
0000:1813 A9 31 mov a,31
0000:1815 8D 00 42 mov [4200],a ; Re-enable interrupts
0000:1818 60 ret
Code: Select all
1 17 MASK_EN B9.01.00.00 00.00.00.00 00.00.00.00 00.00.00.00
1 12 JUMP 91.00.18.00 00.00.00.00 00.00.00.00 00.00.00.00
1 12 JUMP 91.00.18.00 00.00.00.00 00.00.00.00 00.00.00.00
1 12 JUMP 91.00.18.00 00.00.00.00 00.00.00.00 00.00.00.00
1 08 SOUND 41.00.00.00 01.00.00.00 00.00.00.00 00.00.00.00