Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:UNIF ROM image

From ReverseEngineering.wiki
Format
Platforms Platform:Nintendo Entertainment System
Magic 55 4E 49 46 ("UNIF") at offset 0
Extensions .unf, .unif
Endianness little
On this wiki Facts · Code · Notes · Topics

Chunked NES/Famicom cartridge container (.unf, .unif) starting with "UNIF": a 32-byte header, then chunks of a 4-character tag and a little-endian length that name the board (MAPR), the PRG/CHR ROM banks and a few flags. Identifies hardware by board name instead of an iNES mapper number.

Layout

A 32-byte header (the magic "UNIF", then a version word and padding), followed by chunks until the end of the file. Each chunk is a 4-byte ASCII tag, a 32-bit little-endian length and that many data bytes. Mesen2 skips the first 32 bytes without checking the version word and stops reading at the first chunk that does not fit in the file.

Chunks Mesen2 uses

Tag Meaning
MAPR board name as a NUL-terminated string; spaces are dropped; a prefix NES-, UNL-, HVC-, BTL- or BMC- is stripped before the name is looked up in a table of boards. Required
PRG0-PRGF PRG ROM, the last tag character is one hex digit (16 slots); the slots are concatenated in order
CHR0-CHRF CHR ROM, same scheme; no CHR chunk means CHR RAM (Mesen assumes 8 KiB)
TVCI one byte: 1 = PAL, anything else NTSC
BATR one byte: non-zero = battery backed
MIRR one byte: 0 horizontal, 1 vertical, 2 one-screen A, 3 one-screen B, 4 four-screen

Mesen2 reads but ignores CTRL and lists PCKn, CCKn, NAME, WRTR, READ, DINF and VROR as unsupported or unused. A file without a PRG chunk or without a MAPR chunk is rejected.

Identification

A loader chooses the format from the first bytes: NES\x1A iNES, FDS\x1A or the raw disk header Format:FDS disk image, NESM\x1A NSF, NSFE, UNIF, STBX (Study Box). Because UNIF has no mapper numbers, the same hardware can be named by many board strings; emulators keep a board-name table. Hash PRG and CHR (not the 32-byte header) to look a dump up in a ROM database, as Mesen2 does.

Code & repositories

  • https://github.com/SourMesen/Mesen2 @ b9fa69ddc6d0a331fb103fdb5eef6904305703c2 · license: GPL-3.0-only (declared by the contributor for the files used; GitHub reports GPL-3.0 for the repository)
    Core/NES/Loaders/UnifLoader.cpp, FdsLoader.cpp and RomLoader.cpp: UNIF chunks, FDS side layout, format detection
    Tested on: source read, not run · checked 2026-10-19; archived; last activity 2026-06-04; Note: the latest release ships binaries; the wiki links only the source, never the binaries

Pitfalls

  • Unverified: the meaning of the version word and which chunk tags beyond those above exist in the wild (NAME, DINF, WRTR); check against the NESdev wiki page on UNIF.
  • Board names are case-sensitive in Mesen2's table and include odd entries that are not real UNIF boards (for example "255in1" and "PUZZLE", used to assign mappers).

Evidence and references

Mesen2 (GPL-3.0) Core/NES/Loaders/UnifLoader.cpp and RomLoader.cpp at commit b9fa69ddc6d0a331fb103fdb5eef6904305703c2. See Format:INES and NES 2.0 ROM image.