-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Offset | Name | Type (len) | Notes |
---|---|---|---|
0x100 | begin | bytes (4) | Usually 00C35001 |
0x104 | nintendo_logo | bytes (48) | Must be reproduced exactly |
0x134 | title | str (16) | Upper-case ASCII, null padded |
0x144 | licensee | str (2) | Usually 0x00 if offset 0x14B != 0x33 |
0x146 | sgb_flag | byte (1) | Unused in original GameBoy ROMs |
0x147 | cartridge_type | byte (1) | |
0x148 | rom_size | byte (1) | |
0x149 | ram_size | byte (1) | |
0x14A | destination_code | byte (1) | 0 = Japan, 1 = not Japan |
0x14B | old_licensee | byte (1) | if 0x33, see offset 0x144 |
0x14C | mask_rom_version | byte (1) | usually 0x00 |
0x14D | header_checksum | byte (1) | |
0x14E | global_checksum | Uint16 (2) |
begin consists of four bytes. Offset 0x100-0x101 should contain 0x00C3 on all ROMs. The next two bytes point to the location that the Game Boy will jump to to begin execution, usually, though not always, 0x5001 (offset 0x150, directly after the header).
nintendo_logo is a 48 byte bitmap of the Nintendo logo, which is used as copy protection by the Game Boy. If any byte of this is changed, the Game Boy will halt during initial bootup and refuse to run the ROM.
title is a 16 byte ASCII string, all in uppercase, giving the title of the game. If the game title is shorter than 16 characters, the string is padded with null characters (0x00).
In Game Boy Color ROMs, the final byte of this is a flag indicating whether the ROM is a GBC ROM. If it is set to 0x80, the ROM supports GBC, but can be played on GB. If it is set to 0xC0, the ROM is GBC only. Other values cause the GBC to run in non-GBC mode.
In later Game Boy Color ROMs, the title is limited to 11 characters, and offsets 0x13F-0x142 hold a 4 character manufacturer code. Uppercase letters only.
licensee is a 2 byte ASCII string used by newer games (after the release of the Super Game Boy) to identify the publisher of the game. This field is used if offset 0x14B is 0x33.
sgb_flag is set to 0x00 if the game has no SGB support, or 0x03 if the game has SGB support.
cartridge_type indicates certain hardware features of the cartridge (e.g. presence of RAM, battery, or timer).
rom_size indicates the size of the cartridge ROM.
According to the Pan Docs, these mean:
Value | Meaning |
---|---|
0x00 | 32KByte (no ROM banking) |
0x01 | 64KByte (4 banks) |
0x02 | 128KByte (8 banks) |
0x03 | 256KByte (16 banks) |
0x04 | 512KByte (32 banks) |
0x05 | 1MByte (64 banks) - only 63 banks used by MBC1 |
0x06 | 2MByte (128 banks) - only 125 banks used by MBC1 |
0x07 | 4MByte (256 banks) |
0x52 | 1.1MByte (72 banks) |
0x53 | 1.2MByte (80 banks) |
0x54 | 1.5MByte (96 banks) |
ram_size indicates the size of the RAM in the cartridge, if present.
Value | Meaning |
---|---|
0x00 | None |
0x01 | 2KB |
0x02 | 8KB |
0x03 | 32KB |
destination_code is a flag indicating whether the game was to be sold in Japan or elsewhere. Set to 0x00 for Japan, and 0x01 otherwise.
old_licensee indicates the publisher of the game. Newer games set this to 0x33 and store this information in 0x144-0x145 instead.
If this is not set to 0x33, SGB functions will not work.
mask_rom_version indication the game's version number. Usually 0x00.
header_checksum is a 1 byte checksum of the header bytes between 0x134 and 0x14C. Calculate it thus:
checksum = (0 - sum([data[offset] for offset in range(0x134, 0x14d)]) - 25) & 255
For the US release of Mario's Picross, for example, these values are:
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000130 4D 41 52 49 4F 27 53 20 50 49 43 52
00000140 4F 53 53 00 30 31 03 03 03 02 01 33 00
And the checksum is (hex):
00-4D-41-52-49-4F-27-53-20-50-49-43-52-4F-53-53-00-30-31-03-03-03-02-01-33-00-19 = 12
global_checksum is a checksum of the entire ROM (except its own two bytes). Simply sum all bytes except 0x14E-0x14F. This checksum is ignored by the Game Boy.
Most of these details are from the Pan Docs.