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, 11 SNES2Atari (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: composite video | 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; version 4 gives them meanings (mapper and its options, and more) that are not described here | not read |
| 63 | 1 | Expansion | bit 0: the cartridge wants the XM expansion module | read (bit 0) |
| 64 | 36 | Reserved | 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
- Reference: the meanings the version 3 and 4 specifications give to offsets 59 to 62 and 64 to 99 (mapper number, mapper options, audio chips, interrupts, slot passthrough).
- Reference: the remaining bits of offset 57.
Unknown
- Reference: only one real header (version 1) was available; the later versions were not checked against a file.