Fields
The header is 128 bytes long and comes first. Numbers wider than a byte are big-endian (unlike the 6502’s own little-endian
numbers). Every offset marked read below is read by js7800’s header reader (Cartridge.js), and the page test checks that
reader’s source for each; the others are described from the header specification only.
| Offset | Size | Field | Meaning | js7800 |
|---|---|---|---|---|
| 0 | 1 | Header version | 1 to 4 exist; the layout of the fields below is the same in all of them as far as js7800 reads | not read |
| 1 | 16 | Signature | the nine letters ATARI7800 then padding. The test for a header is nine bytes at offsets 1 to 9 | read |
| 17 | 32 | Title | text, padded with spaces or zero bytes | read |
| 49 | 4 | ROM size | the length of the ROM after the header, big-endian. Several files have a wrong value; js7800 then uses the file size when it is a whole number of KiB | read |
| 53 | 2 | Cartridge type | sixteen flags, big-endian: offset 53 is the high byte, 54 the low byte. See Cartridge type bits | read |
| 55 | 1 | Controller 1 | 0 none, 1 7800 joystick, 2 light gun, then 3 paddle, 4 trak-ball, 5 2600 joystick, 6 2600 driving controller, 7 2600 keypad, 8 ST mouse, 9 Amiga mouse, 10 AtariVox/SaveKey, 11 SNES2Atari, 12 Mega7800 (values above 2 from the specification only) | read |
| 56 | 1 | Controller 2 | as controller 1, for the second port | read |
| 57 | 1 | TV type | bit 0: 0 NTSC, 1 PAL. Bit 1: 0 component, 1 composite video. Bit 2: 0 single region, 1 multi-region (bit 2 from the specification only) | read (bits 0 and 1) |
| 58 | 1 | Save device | bit 0: High Score Cartridge, bit 1: SaveKey or AtariVox | read |
| 59 | 4 | Reserved | bytes 59 to 62: reserved in the specification | not read |
| 63 | 1 | Expansion | slot passthrough device, bit 0: the cartridge wants the XM expansion module | read (bit 0) |
| 64 | 1 | Mapper (version 4) | 0 Linear, 1 SuperGame, 2 Activision, 3 Absolute, 4 Souper. In a version 4 header it takes precedence over the version 3 flags | not read |
| 65 | 1 | Mapper options (version 4) | depends on the mapper. Linear: bits 0 and 1 say what is at $4000 (0 none, 1 16K RAM, 2 8K EXRAM/A8, 3 32K EXRAM/M2), bit 7 bankset ROM. SuperGame: bits 0 to 2 (the same four values, then 4 EXROM, 5 EXFIX, 6 32K EXRAM/X2), bit 7 bankset ROM. No meaning is given for the other mappers | not read |
| 66 | 2 | Audio (version 4) | bits 0 to 2: POKEY (0 none, 1 at $0440, 2 at $0450, 3 at $0450 and $0440, 4 at $0800, 5 at $4000); bit 3 YM2151 at $0460; bit 4 COVOX at $0430; bit 5 ADPCM audio stream at $0420. The specification says “2 bytes” and gives no byte order; the explorer reads them big-endian, like offset 53 | not read |
| 68 | 2 | Interrupt (version 4) | bit 0: POKEY 1 (at $0450, $0800 or $4000); bit 1: POKEY 2 (at $0440); bit 2: YM2151. Byte order as for offset 66 | not read |
| 70 | 30 | Reserved | offsets 70 to 99: not defined by the specification; zero in beefdrop.a78 | not read |
| 100 | 28 | Footer | the text ACTUAL CART DATA STARTS HERE in the older header versions; newer versions may use these bytes for other things | not read |
The footer text is exactly 28 characters, so it fills offsets 100 to 127 and the ROM starts at 128.
The size field and the real size
The explorer maps the ROM it finds after the header, whatever the size field says, and reports a mismatch. js7800 does the same when the file’s data is a whole number of KiB, and trusts the header otherwise.
Not described
Known, not yet covered
- Viewer: the version 4 mapper is shown but does not change how the ROM is laid out (the cartridge type flags and the options bar still do), and the mapper options at $4000 (extra RAM, EXROM, EXFIX) are not mapped.
Unknown
- Reference: the byte order of the 2-byte audio and interrupt fields (offsets 66 and 68): the 8BitDev specification gives no order. The other bits of offset 65 and the bytes at offsets 59 to 62 and 70 to 99 are not defined there.
- Reference: only one real header (version 1) was available; the later versions were not checked against a file.