Layout
An NSFe file is the four letters NSFE followed by chunks to the end of the file. The
header of the NSF is replaced by the INFO chunk, and
the program is in the DATA chunk. A chunk is:
| Size | Type | Field |
|---|---|---|
| 4 | u32 (little-endian) | The length of the data, not counting these eight bytes. |
| 4 | ASCII | The chunk id. |
| length | bytes | The data. |
A chunk whose id starts with a capital letter is mandatory: a player that does not
know it must not play the file. A lower-case first letter marks an optional chunk that can be skipped.
INFO must come first and DATA before NEND. The file ends with an NEND chunk of length 0. The same
chunks, without the NSFE marker, can be appended to an
NSF2 file.
The chunks
| Id | Required | Contents |
|---|---|---|
INFO | yes | At least nine bytes: load address u16, INIT address u16, PLAY address u16, region byte and chip flags (both as in the NSF header), number of songs, and a tenth byte, the start song counted from 0. If the start song is missing, 0 is taken. Extra bytes are ignored. The chunk is not allowed in NSF2 metadata. |
DATA | yes | The program and music data, placed at the load address. |
NEND | yes | Length 0. The end of the file; anything after it is ignored. |
BANK | no | Eight bytes: the initial banks. Missing bytes are 0, extra bytes are ignored. Its presence turns bank switching on. |
RATE | no | Up to three u16 play periods in microseconds: NTSC, PAL (optional) and Dendy (optional). A missing Dendy period means the PAL period. Leave the chunk out when the default rates are used. |
NSF2 | no | One byte of NSF2 flags. |
VRC7 | no | The first byte names the device at the VRC7 addresses: 0 the VRC7, 1 the YM2413. Optionally 128 or 152 more bytes follow, a replacement set of instrument patches (the first 8 bytes zero; the larger set also customises the YM2413 rhythm instruments). |
plst | no | A play list: one byte for each entry, the number of the song, counted from 0. |
psfx | no | The songs, counted from 0, that are sound effects rather than music, one byte each. |
time | no | For each song an s32 length in milliseconds, after which it fades out. 0 starts the fade at once; a negative value is the default. Missing entries are the default. |
fade | no | For each song an s32 length of the fade-out in milliseconds. 0 ends the song at once; a negative value is the default. |
tlbl | no | The names of the songs, each a zero-ended UTF-8 string, in order. |
taut | no | The author of each song, each a zero-ended UTF-8 string. |
auth | no | Four zero-ended UTF-8 strings: game title, artist, copyright holder, ripper. |
text | no | A zero-ended UTF-8 note, shown to the user, such as the history of the rip. |
mixe | no | Entries of three bytes, a device byte and an s16 level in millibels (1/100 dB) compared with the APU square volume:0 for the pulse channels, 1 triangle, noise and DPCM, 2 VRC6, 3 VRC7, 4 FDS, 5 MMC5, 6 Namco 163, 7 Sunsoft 5B. |
regn | no | A mask of the supported regions (bit 0 NTSC, bit 1 PAL, bit 2 Dendy; bits 3 to 7 clear), then optionally the preferred region (0 NTSC, 1 PAL, 2 Dendy). It overrides the region byte of INFO. A player that picks Dendy passes X = 2 to INIT. |
A chunk id that starts with a capital letter and is not listed, makes the file one that a player cannot play properly. The ids are case-sensitive.
In the explorer
Each chunk is a node with its id, length and decoded fields. The missing mandatory chunks, a chunk that is cut short, a chunk after NEND, and a mandatory chunk that is not known are listed as problems. The track names, authors, the strings of the auth chunk and the mixing table are shown in the Tune tab. The explorer does not yet apply the time, fade, play list or mixing values to the sound.