The fixed part
The file has a fixed layout, and every offset below is from the start of the file. A file is at least $10180 (65,920) bytes, enough for the RAM and the DSP registers; the full size is $10200 (66,048) bytes, with the last 64 bytes of RAM. Numbers of two bytes are little-endian. The first 256 bytes are the header and the tag; the RAM follows.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| $00 | 33 | text | signature | SNES-SPC700 Sound File Data v0.30. The text before the version is the signature; the version in it is not read by players, and files of the later revision still say v0.30. |
| $21 | 2 | u8 × 2 | 26, 26 | The bytes $1A $1A. |
| $23 | 1 | u8 | tag flag | 26: the file has an ID666 tag. 27: it has none and the tag area is to be ignored. |
| $24 | 1 | u8 | minor version | The revision of the format: 30 for v0.30. Version 0.31 files say 31 and may have an xid6 chunk after the fixed part. Files with 10 here exist and are read the same way. |
| $25 | 2 | u16 | PC | The program counter of the SPC700 at the snapshot. |
| $27 | 1 | u8 | A | The accumulator. |
| $28 | 1 | u8 | X | The X index register. |
| $29 | 1 | u8 | Y | The Y index register. |
| $2A | 1 | u8 | PSW | The status flags: negative (bit 7), overflow (6), direct page (5), break (4), half carry (3), interrupt enable (2), zero (1) and carry (0). |
| $2B | 1 | u8 | SP | The stack pointer: the stack is page 1 of the RAM, so 239 ($EF) is address $01EF. |
| $2C | 2 | bytes | reserved | Zero. |
| $2E | 210 | bytes | ID666 tag | Song, game, dumper, comments, date, length, fade, artist, channel flags, emulator. |
| $100 | 65,536 | bytes | RAM | The 64 KB of the sound unit, address $0000 to $FFFF. |
| $10100 | 128 | bytes | DSP registers | The 128 registers of the S-DSP, $00 to $7F. |
| $10180 | 64 | bytes | unused | Unused. |
| $101C0 | 64 | bytes | boot ROM area | The 64 bytes of RAM at $FFC0 to $FFFF that the boot ROM hides when it is switched on. A file cut at $10180 lacks them. |
| $10200 | … | bytes | xid6 | Optional extended tag items; anything else after the fixed part is not part of the format. |
In the explorer
Every field is a node of the structure tree, with the flags of PSW broken down in the value. A file whose signature is wrong is not read as SPC. A file shorter than the RAM and the DSP registers is read as far as it goes and listed as cut short, and one without the last 64 bytes is played with the boot ROM area as zeros. The length of the file from the tree is always the length of the file, whatever it contains.
Sources
- SPC file format v0.30: the offsets, the signature and the fixed areas.
- SPC and RSN file format (SNESdev wiki): the minimum and full sizes and the later revision.