Fields
All two-byte values are little-endian: a play rate of FF 40 is
$40FF, 16639 microseconds. The header is 128 bytes ($80), and
the program data starts straight after it.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| +00 | 5 | bytes | magic | 4E 45 53 4D 1A: the letters NESM and $1A. |
| +05 | 1 | u8 | version | 1 for NSF, 2 for NSF2. |
| +06 | 1 | u8 | songs | The number of songs; 1 is one song. INIT is called with a song number from 0 to this minus 1. |
| +07 | 1 | u8 | start song | The song to play first, counted from 1. The player subtracts 1 before calling INIT. (The NSFe INFO chunk counts from 0.) |
| +08 | 2 | u16 | load address | Where the data is placed, $8000 to $FFFF. With bank switching only its low 12 bits count, as padding. Some FDS tunes load below $8000, to fill $6000 to $7FFF. |
| +0A | 2 | u16 | init address | The INIT routine: called once for each song. |
| +0C | 2 | u16 | play address | The PLAY routine: called at the play rate. |
| +0E | 32 | string | name | The name of the tune, ended by a zero byte. |
| +2E | 32 | string | artist | The artist, if known, ended by a zero byte. |
| +4E | 32 | string | copyright | The copyright holder, ended by a zero byte. |
| +6E | 2 | u16 | NTSC rate | The time between PLAY calls on an NTSC console, in microseconds. |
| +70 | 8 | u8 × 8 | banks | The initial banks of $8000 to $FFFF, in 4 KB steps. All zero: no bank switching. |
| +78 | 2 | u16 | PAL rate | The time between PLAY calls on a PAL console, in microseconds. |
| +7A | 1 | u8 | region | Bit 0 clear: an NTSC tune; set: a PAL tune. Bit 1 set: a tune for both, and bit 0 may then be read as the preferred console. Bits 2 to 7 are reserved and 0. |
| +7B | 1 | u8 | chips | The extra sound chips the tune uses, one bit each. |
| +7C | 1 | u8 | NSF2 flags | Reserved in version 1 and ignored there. |
| +7D | 3 | u24 | data length | 0: the data runs to the end of the file. Otherwise the program data is this long and any metadata follows it. |
| +80 | … | bytes | data | The 6502 program and the music data. |
When an NSF2 file carries appended metadata, the specification says it should end with an
NEND chunk. A file whose metadata does not end that way is read as far as its chunks go,
and the explorer shows a notice, not an error.
Play rates
The rate in hertz is 1,000,000 divided by the period. The common periods are:
| Period | Value | Rate | Use |
|---|---|---|---|
| 16666 | $411A | 60.002 Hz | Recommended by the original specification. |
| 16639 | $40FF | 60.099 Hz | The frame rate of an NTSC NES. |
| 19997 | $4E1D | 50.007 Hz | The suggested rate for PAL. |
A tune is called at the NTSC rate when INIT was given X = 0 and at the PAL rate when X = 1. A Dendy console (a Famicom clone with a PAL frame rate and an NTSC-like processor) has no field in the version 1 header; the NSFe RATE and regn chunks add it. A player that wants Dendy and has no rate for it uses the PAL rate.
The strings
The three text fields are plain ASCII in most files, with Japanese titles written in the Latin alphabet. Some files use Windows code page 932 (Shift JIS) for Japanese titles, and a few code page 1252. NSF2 and NSFe files should use UTF-8. A string fills its 32 bytes at most, so one of 32 characters has no zero byte.
In the explorer
Every field is a node in the structure tree, with the flags worked out beside the value and a
note under each field. The play rates are shown as a period and a frequency, with a note when a
file leaves the PAL rate at 0 and the standard rate is used. A header whose version is not 1 or 2,
with a start song outside the songs, with reserved bits set or a load address below
$8000 in a file with no FDS chip and no bank switching is read as far as it goes
and the rule that is broken is listed as a problem.