Sega Master System / Mark III / Game Gear
All Game Gear and export Master System, and some Japanese Master System, games include a header which provides information about the ROM and a means to detect its validity. The BIOS in non-Japanese Master Systems requires a valid header and later Game Gears will also not run software without one.
This page describes the contents of the header. It is worth remembering that, apart from cases where failing the BIOS checks would render it unusable, there are many instances where the values found in the header contain mistakes.
The header can be at offset $1ff0, $3ff0 or $7ff0 in the ROM, although only the last of these seems to be used in known software. The header is 16 bytes long.
The first eight bytes of the header are the ASCII text "
TMR SEGA". The export Master System and Game Gear BIOSes require this to be present to indicate valid data.
The next two bytes are unused. They are often $00 $00, $ff $ff or $20 $20 - the latter due to some Sega documentation which merged them with the TMR SEGA string to give "
TMR SEGA ".
This little-endian word gives the ROM checksum for export SMS BIOSes. Game Gear and Japanese releases tend not to have a correct checksum there.
The BIOS checksum routines compare the calculated value to this to determine if the cartridge data is valid.
The first 2 bytes are a Binary Coded Decimal representation of the last four digits of the product code. Hence, data
26 70 gives a product code 7026.
The high 4 bits of the next byte (hence, 0.5 bytes) are a hexadecimal representation of any remaining digits of the product code. Hence, data
26 70 2 gives a product code of 27026 and
26 70 a gives a product code of 107026.
The low 4 bits of the 15th byte of the header give a version number. This is generally 0 for the first release and incremented for later revisions (which often have bugfixes).
The high 4 bits of the 16th byte of the header give the region and system for which the cartridge is intended:
Only the export SMS BIOS actually checks this.
The final 4 bits give the ROM size, which may be used by the BIOS to determine the range over which to perform the checksum. Values are:
The values labelled as "buggy" should not be used because some or all of the BIOSes that implement checksum validation have errors in their implementations.
It is common for this value to be present even when the checksum is not. It is also common for it to indicate a ROM size smaller than the actual ROM size, perhaps to speed up the boot process by speeding up the checksum validation.