nes-formatlisted
Install: claude install-skill Yuki001/nes-skills
# NES ROM Format Reference
Three ROM formats exist: **iNES**, **NES 2.0**, and **UNIF**. NES 2.0 is the current standard and recommended for new dumps. UNIF is deprecated.
## Format Detection Quick Guide
| Signature in file | Format |
|-------------------|--------|
| `NES` + `$1A` + byte 7 bits 3-2 = `10` | NES 2.0 |
| `NES` + `$1A` + byte 7 bits 3-2 ≠ `10` | iNES |
| `UNIF` | UNIF |
---
## iNES Format (.nes)
Created by Marat Fayzullin for the iNES emulator. Uses an 8-bit mapper number (0–255). Bytes 8–15 are loosely defined and vary between iNES revisions. NES 2.0 repurposes them with a formal specification.
### File Layout
```
[16-byte Header] [optional 512-byte Trainer] [PRG-ROM data] [CHR-ROM data]
```
Some ROM images also have a 128-byte title at the end of the file.
### Header Byte Map
| Byte | Field |
|------|-------|
| 0–3 | `$4E $45 $53 $1A` — "NES" + MS-DOS EOF |
| 4 | PRG-ROM size in 16KB units |
| 5 | CHR-ROM size in 8KB units (0 = CHR-RAM used) |
| 6 | Flags 6: `NNNN FTBM` |
| 7 | Flags 7: `NNNN xxTT` |
| 8 | PRG-RAM size in 8KB units (0 infers 8KB for compatibility) |
| 9 | TV system: bit 0 = 1 if PAL |
| 10 | Unofficial extension: TV system, PRG-RAM presence, bus conflicts |
| 11–15 | Padding (should be zero, but some tools wrote identifying strings here) |
### Byte 6 Flags (`NNNN FTBM`)
| Bit | Name | Meaning |
|-----|------|---------|
| 0 | M | Nametable arrangement: 0 = vertical mirroring, 1 = horizontal mirroring |
| 1 | B | Battery-backed PRG-R