The iNES header was introduced by Marat Fayzullin’s iNES emulator and is described today by the NESdev Wiki, which this page follows. The header grew in stages (see header generations), so later fields are honoured by fewer emulators than earlier ones.
File layout
| Part | Size | Present |
|---|---|---|
| Header | 16 bytes | always |
| Trainer | 512 bytes | when flags 6 bit 2 is set |
| PRG ROM (program) | 16 384 × byte 4 | always |
| CHR ROM (graphics) | 8 192 × byte 5 | when byte 5 is not 0 |
| PlayChoice INST-ROM | 8 192 bytes | PlayChoice-10 games only, when flags 7 bit 1 is set |
| PlayChoice PROM | 16 bytes of data, 16 bytes of CounterOut | PlayChoice-10 games; often missing |
Some tools add a title of about 127 or 128 bytes at the very end of the file. Nothing in the header says so; a reader notices it only because the file is longer than the parts above.
Header
| Byte | Name | Meaning |
|---|---|---|
0–3 | Signature | 4E 45 53 1A: NES and the MS-DOS end-of-file character. |
4 | PRG ROM size | In 16 KiB units. |
5 | CHR ROM size | In 8 KiB units. 0 means the board has CHR RAM instead. |
6 | Flags 6 | Mirroring, battery, trainer, alternative nametables, mapper bits 0–3. Below. |
7 | Flags 7 | Vs. System, PlayChoice-10, NES 2.0 marker, mapper bits 4–7. Below. |
8 | Flags 8 | PRG RAM size. Below. |
9 | Flags 9 | TV system. Below. |
10 | Flags 10 | Unofficial: TV system, PRG RAM, bus conflicts. Below. |
11–15 | Padding | Should be zero. |
Flags 6
| Bit | Meaning |
|---|---|
| 0 | Nametable arrangement. 0: vertical arrangement, called horizontal mirroring (CIRAM A10 = PPU A11). 1: horizontal arrangement, called vertical mirroring (CIRAM A10 = PPU A10). Ignored by mappers that set mirroring themselves, such as MMC1, MMC3 and AxROM. |
| 1 | The cartridge has battery-backed PRG RAM at $6000–$7FFF, or other memory kept when the power is off. (Some boards, such as UNROM 512 and GTROM, save by rewriting flash PRG ROM instead.) |
| 2 | A 512-byte trainer follows the header; it is loaded at $7000–$71FF. |
| 3 | Alternative nametable layout. Its meaning depends on the mapper: for most it means four-screen VRAM on the cartridge (as on the MMC3 board of Rad Racer 2, or mapper 206 for Gauntlet); UNROM 512 and mapper 218 combine it with bit 0 to select other layouts. |
| 4–7 | Mapper number, bits 0–3. |
The trainer usually holds code that translates mapper register writes and caches CHR RAM. It was used by early RAM cartridges that could not imitate mapper chips, and by the DOS emulator NESticle. Unmodified dumps of cartridges do not include one.
Flags 7
| Bit | Meaning |
|---|---|
| 0 | Vs. Unisystem: an arcade game for Nintendo’s Vs. System, with coin inputs and its own palettes. The header does not say which palette. |
| 1 | PlayChoice-10: 8 KiB of hint-screen data follow the CHR data. Not part of the official header; most emulators ignore it. |
| 2–3 | 00 in an iNES header. 10 (binary) marks a NES 2.0 header; 01 is found in archaic headers. |
| 4–7 | Mapper number, bits 4–7. |
Flags 8
The whole byte is the PRG RAM size in 8 KiB units, where 0 means 8 KiB (for files written before the field existed). It was added late and almost no files use it.
Flags 9
| Bit | Meaning |
|---|---|
| 0 | TV system: 0 NTSC, 1 PAL. |
| 1–7 | Reserved, zero. |
Part of the official header, but very few files set it, so few emulators honour it.
Flags 10 (unofficial)
| Bit | Meaning |
|---|---|
| 0–1 | TV system: 0 NTSC, 2 PAL, 1 or 3 dual compatible. |
| 2–3 | Unused. |
| 4 | PRG RAM at $6000–$7FFF: 0 present, 1 not present. |
| 5 | 0: the board has no bus conflicts. 1: it has bus conflicts. |
| 6–7 | Unused. |
Not part of the official header, and relatively few emulators read it.
Mapper number
The mapper number names the cartridge board, chiefly the chip that switches banks of ROM
and RAM. It is (flags 7 AND 0xF0) OR (flags 6 >> 4), 0 to 255. Archaic
headers had only the low four bits (0 to 15). The numbering was made popular by the
iNES emulator; the NESdev Wiki documents each assigned number on its own page. The
table below is the NESdev Wiki’s list of commonly met mappers:
| Mapper | Board or chip |
|---|---|
| 0 | NROM (no mapper) |
| 1 | SxROM, MMC1 |
| 2 | UxROM |
| 3 | CNROM |
| 4 | TxROM, MMC3, MMC6 |
| 5 | ExROM, MMC5 |
| 7 | AxROM |
| 9 | PxROM, MMC2 |
| 10 | FxROM, MMC4 |
| 11 | Color Dreams |
| 13 | CPROM |
| 15 | 100-in-1 Contra Function 16 |
| 16 | Bandai EPROM (24C02) |
| 18 | Jaleco SS8806 |
| 19 | Namco 163 |
| 21 | VRC4a, VRC4c |
| 22 | VRC2a |
| 23 | VRC2b, VRC4e |
| 24 | VRC6a |
| 25 | VRC4b, VRC4d |
| 26 | VRC6b |
| 34 | BNROM, NINA-001 |
| 64 | RAMBO-1 |
| 66 | GxROM, MxROM |
| 68 | After Burner |
| 69 | Sunsoft FME-7, 5A, 5B |
| 71 | Camerica/Codemasters |
| 73 | VRC3 |
| 74 | Pirate MMC3 derivative |
| 75 | VRC1 |
| 76 | Namco 109 variant |
| 79 | NINA-03, NINA-06 |
| 80 | Taito X1-005 |
| 82 | Taito X1-017 |
| 85 | VRC7 |
| 86 | Jaleco JF-13 |
| 94 | Senjou no Ookami |
| 105 | NES-EVENT |
| 113 | HES NTD-8 |
| 118 | TxSROM, MMC3 |
| 119 | TQROM, MMC3 |
| 159 | Bandai EPROM (24C01) |
| 166, 167 | Subor |
| 180 | Crazy Climber |
| 185 | CNROM with protection diodes |
| 192 | Pirate MMC3 derivative |
| 206 | DxROM, Namco 118, MIMIC-1 |
| 207 | Taito X1-005 with independent mirroring control |
| 210 | Namco 175 and 340 |
| 228 | Action 52 |
| 232 | Camerica/Codemasters Quattro |
Other numbers up to 255 are listed, without names, in the NESdev Wiki’s mapper grid; a full named register of them is not given here. Numbers above 255 exist only in NES 2.0 headers.
Header generations and DiskDude!
Because early versions of iNES ignored bytes 7 to 15, tools used to write their own
text there. The commonest is DiskDude! from byte 7, whose D
(0x44) read as flags 7 adds 64 to the mapper number. The NESdev rule:
if the last four bytes are not all zero and the header is not marked as NES 2.0, an
emulator should ignore the upper four mapper bits or refuse the file.
Byte 7 AND 0x0C | Also | Header |
|---|---|---|
0x08 | the ROM sizes in byte 9 fit in the file | NES 2.0 |
0x04 | — | archaic iNES (bytes 7–15 may hold text) |
0x00 | bytes 12–15 all zero | iNES |
| anything else | — | iNES 0.7 or archaic iNES: use only the low mapper nibble |
The generations: archaic iNES (Marat Fayzullin’s first header, also used by NESticle, mapper 0–15 only); iNES 0.7, which added the upper mapper nibble in byte 7, supported by emulators from about 2000; and iNES as described here, with bytes 8 and 9.
Worked example
4E 45 53 1A "NES" + 0x1A
02 PRG ROM: 2 × 16 KiB = 32 KiB
01 CHR ROM: 1 × 8 KiB
01 flags 6: bit 0 set (vertical mirroring), no battery,
no trainer, mapper low nibble 0
00 flags 7: not Vs., not PlayChoice, iNES, mapper high nibble 0
00 00 00 flags 8, 9, 10: unused (8 KiB PRG RAM implied, NTSC)
00 00 00 00 00 padding
For a battery-saving MMC1 game with 256 KiB of PRG ROM and CHR RAM, bytes 4 to 7 would
be 10 00 12 00: 16 × 16 KiB of PRG, no CHR ROM, and flags 6 =
0x12, that is mapper low nibble 1 and the battery bit.
Sources
- iNES – NESdev Wiki: file layout, every header byte and flag bit, DiskDude!, header generations and the detection procedure
- List of mappers – NESdev Wiki: the commonly met mappers in the table
- Mapper – NESdev Wiki: the grid of all assigned mapper numbers
The worked examples are made up for this page.