From [[http://nocash.emubase.de/everynes.htm]]: ===== Cartridge ROM-Image File Formats ===== ==== iNES Format (.NES) ==== This fileformat and mapper-numbers have been designed/assigned by Marat Fayzullin (author of iNES emulator), please contact him if you want to make any changes to the format or numbers. The file header is 16 bytes: 00h File ID ('NES',1Ah) 04h Number of 16K PRG-ROM pages 05h Number of 8K CHR-ROM pages (00h=None / VRAM) 06h Cartridge Type LSB Bit7-4 Mapper Number (lower 4bits) Bit3 1=Four-screen VRAM layout Bit2 1=512-byte trainer/patch at 7000h-71FFh Bit1 1=Battery-backed SRAM at 6000h-7FFFh, set only if battery-backed Bit0 0=Horizontal mirroring, 1=Vertical mirroring 07h Cartridge Type MSB (ignore this and further bytes if Byte 0Fh nonzero) Bit7-4 Mapper Number (upper 4bits) Bit3-2 Reserved (zero) Bit1 1=PC10 game (arcade machine with additional 8K Z80-ROM) (*) Bit0 1=VS Unisystem game (arcade machine with different palette) 08h Number of 8K RAM (SRAM?) pages (usually 00h=None-or-not-specified) 09h Reserved (zero) 0Ah Reserved (zero) (sometimes 03h,10h,13h,30h,33h purpose unknown) (*) 0Bh Reserved (zero) 0Ch Reserved (zero) 0Dh Reserved (zero) 0Eh Reserved (zero) 0Fh Nonzero if [07h..0Fh]=GARBAGE, if so, assume [07h..0Fh]=ALL ZERO (*) Followed by 512 byte trainer (if any, see Byte 6, Bit 2, mainly FFE games). Followed by N*16K PRG-ROM pages (see Byte 4). Followed by N*8K CHR-ROM pages (if any, see Byte 5). Followed by 8K Play Choice 10 Z80-ROM (if any, see Byte 7, Bit 1) (*). Followed by 128 (or 127) bytes title at end of file (ASCII, zero-padded) (*). Items marked as (*) are regulary used, but not offical part of the format. Many PC10 files declare Z80-ROM as additional VROM bank (instead Byte7/Bit1). ==== .UNF - Universal NES Image File Format (UNIF) by Tennessee Carmel-Veilleux ==== A "newer" fileformat dated back to 2000, the relation between iNES mapper numbers and UNIF MAPR names is still undocumented, and of course nobody uses files with .UNF extension. Still, it's having one or two useful features, and may become more popular if somebody dares to fix the MAPR problem, and to rename it from .UNF to .NES extension. File Header (32 bytes) 00h-03h: "UNIF" tag identifier 04h-07h: Revision number ("currently 4, for REV 7b, Revision 6 of UNIF" Huh!) 08h-1Fh: Reserved for future usage The header is followed by whatever chunks, all chunks are optional, and may or may not be included in the file, only the PRG0 one is obviously required. Software may skip any chunks which are uninteresting or unrecognized, each chunk formatted as such: 00h-03h: Chunk ID string (4-letter ASCII, described below) 04h-07h: Length of Data Block in bytes (excluding above ID and length entry) 08h... : Data MAPR - Board Name (aka Mapper) (ASCIZ, suggested max: 32 chars) This uses ASCIZ strings to describe the board names (instead of iNES mapper numbers), it's meant to be more specific than mapper numbers, for example, it's using different names for different MMC1-boards. http://www.parodius.com/~veilleux/boardtable.txt http://www.parodius.com/~veilleux/boardnames PRG0..PRGF - Binary data of the PRG ROM CHR0..CHRF - Binary data of the CHR ROM (aka VROM in general) Normally using only PRG0 (and CHR0, if VROM used). In rare cases, if the cart contains more than 1 PRG (or CHR) ROM chip, then PRG1-F and CHR1-F may be used for the additional chips. TVCI - Television Standards Compatability Information (One Byte) 00h 60Hz/NTSC (USA, Japan, etc.) 01h 50Hz/PAL (Germany, etc.) 02h Compatible with both 50Hz and 60Hz refresh rates CTRL - Controllers used by the cartridge (currently only 1 Byte / 8bit) Bit0 Regular Joypad Bit1 Zapper Bit2 R.O.B Bit3 Arkanoid Controller (presumably Paddle) Bit4 Power Pad Bit5 Four-Score adapter (NES 4-player adapter) (Not Famicom adapter!) Bit6-7 Reserved MIRR - Name Table Mirroring (1 Byte) 00h Two-Screen Horizontal Mirroring (Hard Wired) 01h Two-Screen Vertical Mirroring (Hard Wired) 02h Single-Screen BLK0 (Hard Wired) 03h Single-Screen BLK1 (Hard Wired) 04h Four-Screens of VRAM (Hard Wired) 05h Mirroring Controlled By Mapper Hardware BATR - Battery installed on Board (1 dummy byte) Presence of this chunk means yes, absence means no. NAME - Game Title, ASCIZ String Game Title READ - Readme/Comments/Notes/Credits Probably some sort of ASCII text of unspecified formatting VROR - Allow homebrewn games to over-write VROM (1 dummy byte) Presence of this chunk means yes, absence means no. PCK0..PCKF - 32-bit CRCs for PRG0..PRGF blocks (4 bytes, each) CCK0..CCKF - 32-bit CRCs for CHR0..CHRF blocks (4 bytes, each) Intended "to make sth sure on EPROMs" ;-) Checksum algorythm not specified. DINF - Dumper information block (204 Bytes) 100 bytes ASCIZ name of the person who dumped the cart 4 bytes day, month, year-lsb, year-msb when cartridge was dumped 100 bytes ASCIZ agent "name of the ROM-dumping means used" Note: All words and dwords in header/chunks stored LSB first.