Wednesday, January 9, 2013

SPC Stuff

Checking out how the game organizes SPC700 memory so I can do stuff like allowing sample expansion and warn if the samples you chose won't all fit into memory for a given song.

Looks like the DSP code runs until SPC address x4DF1, so I have about 70% of the RAM (45K) left to play with for samples and music data.

Edit: Meh, on second glance, the music data sits at 1A00, and runs until 2C00, between two blocks of code.  Some of the larger songs (like the mana beast fight theme) take up almost this entire block.  I'm going to have to do some reorganizing before longer songs are doable.

Edit2: Ah ha; the 2C00 block that appears after the music data (from C32137 in the ROM) seems to be the sound effects, something I hadn't found much on until now. Nice I guess, but moving it elsewhere would be nice... optimally I'd stick that stuff at 1A00, followed by the music, followed by the samples (which currently start at 4DF1 and run through pretty much the rest of the SPC RAM), that way all the dynamic stuff is in one big block, and I can shift it around as I please. I'm pretty sure all the static stuff (code, and presumably the sound effects) gets uploaded once when the game starts then never again.  Music is also tricky because all of the offsets and jumps it uses are 16-bit ROM addresses, so I'm guessing it applies some static offset (like 1A00) to them to figure out where in SPC RAM to actually jump.

Kind of wish I had Tales of Phantasia's code that streams samples in and out as needed.  That would be a hell of a project to import...

1 comment:

RetroHelix said...

Ahhh, nice to read your technical findings again :) It's good to hear you are progressing.