Introduction
A .gb file is a copy of the ROM in a cartridge for Nintendo’s Game Boy,
for playing in an emulator or writing to a flash cartridge. Games made for the Game Boy
Color are usually named .gbc. Unlike most ROM image formats, there is no
header added by the dumping tool: the file is the ROM exactly, and the information an
emulator needs is in the cartridge header that every game already contains.
Structure
The first 256 bytes hold the restart and interrupt vectors of the console’s processor.
The cartridge header follows at 0x100. It starts with the entry point,
usually a jump past the header, and the Nintendo logo, which the console’s boot ROM
checks before it runs the game. Then come the title, a flag for Game Boy Color
support (0x80 for games that also run on the original, 0xC0
for Color-only games), a flag for Super Game Boy features, the cartridge type, which
names the memory bank controller and any battery or real-time clock, and the ROM and RAM
sizes. The header checksum at 0x14D covers bytes 0x134 to
0x14C, and the boot ROM refuses to start a game whose checksum is wrong.
0x000restart and interrupt vectors256 bytes0x100entry point4 bytes0x104Nintendo logo bitmap48 bytes0x134title, ending in the manufacturer code and Color flag on later games16 bytes0x144new licensee code, Super Game Boy flag3 bytes0x147cartridge type, ROM size, RAM size3 bytes0x14Adestination, old licensee code, version3 bytes0x14Dheader checksum, then global checksum3 bytes0x150the game’s code and data, in 16 KB banksvaries
Links
Software
Reference
- The Cartridge Header, Pan Docs