EarthBound/Audio

From Data Crystal
Jump to navigation Jump to search

SPC RAM

As with all SNES games, audio data must be loaded into the SPC700's RAM before it can be played. This RAM contains all the song data, the instrument data, the sample data, and even the music playback code itself. The lower 32K of the SPC's 64KB memory (0000-7FFF) is used to hold all this data, and the upper 32K (8000-FFFF) is used by the SPC chip itself to hold internal state information. .SPC files are nothing more than a straightforward RAM dump of the SPC chip with a 256-byte header attached.

Song SPC Pointer Table

This table is located at 262B8C in the ROM and contains 191 (0xBF) entries. Not all songs are loaded into the same offset in SPC RAM, so this table is used to tell where in SPC RAM the song is located. Each entry is a two-byte pointer in little-endian (LSB first) format.

The first entry in the table is actually song 01, not song 00 (i.e., the table is accessed as if it began at 262B8A instead of 262B8C). Song 00 does not point to an actual song (in fact, it points to an area in the SPC700's upper memory, where the game cannot load its song data), and its space in the table is probably used by the preceding data chunk. The last song is actually song C0, although it is entry BF in the table.