ROM footer

Eric Ball and Bruce Tomlin wrote on AA:

The last 8 bytes in a 7800 ROM contain the following:

        DC.W ROMTOP + $07FF

NMI     DC.W DLLNMI

RESET DC.W START

IRQ     DC.W IRQRTI

Where ROMTOP is the first page (through $FF7F) the NTSC digital signature ($FF80 - $FFF7) covers. 

The last six bytes are the standard 6502 reset/IRQ/NMI vectors, low byte first. The NMI vector is used by the MARIA DLI interrupt, and IRQ can be generated from the cartridge slot.  On powerup the 7800 starts with the BIOS ROM active. Once the BIOS determines the cartridge is a 7800 cartridge (or a 2600 cart & locks the 7800 into 2600 mode), then it does an indirect JMP to the RESET vector.  And the RESET/IRQ/NMI vectors MUST point into the address range that is checked for the digital signature.

$FFF8 and $FFF9 have special meanings. I'm looking at the documentation from my sign7800 program, and here's a quick summary:

$FFF8 is used for the region checking. The high 4 bits must always be set ($Fx), and on a US machine (EDIT: apparently this is not true!), the low bit must be set. Presumably there is no region check in the PAL version, but I would have to check. - - - Hmm, I just checked my disassembly where I merged in the NTSC source where possible, and it checks the same bit in PAL.

$FFF9 is used for the signature check and for the rainbow ATARI screen. The high 4 bits are the high nibble of the lowest address in the digital signature range. The ROM is hashed from that address to $FF7F, then the hash is run through the crypto routine. This should not include bank-switched memory, so in larger games this will be $Cx, $Dx, $Ex, or $Fx. The higher this number, the faster the startup, so just 4K ($Fx) is optimal. The low nibble must be $x3 or $x7. $x3 will disable the rainbow ATARI, but the game won't start up any faster.