Logo

NEWS
+ Current News

GAMEBOY
+ Emulators
+ Tutorials
+ Cribsheet
   - Opcodes and Timings
   - Memory Map
   - Cartridge Header
   - Hardware Registers
+ Downloads
+ Links

PC
+ Source Code
   - C++
   - ASM
+ Links

CONTACT
+ Adrian@enliten.force9.co.uk
+ ICQ 8715274

You are visitor

Since 21st May 2000

Copyright (c) 1999, 2000 Adrian Brown
If you have any complaints about this website or its contents, please email me and I will remove or update the offending section.

Gameboy Cartridge Header

Every cartridge that runs on a Gameboy has a header of 50h bytes that starts at memory location 100h.  This header is used to let the gameboy know what sort of cartridge is plugged in, the name of the cartridge and which gameboy it is compatible with.  The following table is a brief description of this header, ill go into each byte in more detail following it.

MEMORY ADDRESS CONTENTS
014F Checksum LSB
014E Checksum MSB
014D Complement Checksum
014C Mask ROM Version
014B Old Licensee Code
014A Destination Code
0149 Cartridge RAM Size
0148 Cartridge ROM Size
0147 Cartridge Type
0146 GB/SGB Function
0145 New Licensee Code LSB
0144 New Licensee Code MSB
0143 Colour Compatibility
0134 Game Title
0104 Nintendo Logo
0101 JP ????h
0100 NOP

The first 4 bytes of the header, starting at 0100h, are a NOP followed by a JP command.   The jump is usually to 0150h which is just after the header.  Following this is 30h bytes of the nintendo logo,  these bytes must be : -

CD, ED, 66, 66, CC, 0D, 00, 0B, 03, 73, 00, 83, 00, 0C, 00, 0D
00, 08, 11, 1F, 88, 89, 00, 0E, DC, CC, 6E, E6, DD, DD, D9, 99
BB, BB, 67, 63, 6E, 0E, EC, CC, DD, DC, 99, 9F, BB, B9, 33, 3E

This is the graphic data for the Nintendo logo that is shown on the startup of a gameboy game.  Before you get any ideas of changing this to be a logo of your own, it is compared with an internal copy and if found to be different the cartridge will not boot.

The next 15 bytes are the title of the game in uppercase ASCII, if the name is less than 15 characters the rest of the name must be padded with 00h bytes.  The byte at 0143h is used to tell whether the game is a colour gameboy game or not.  If this byte is set to 80h then this is a colour gameboy game else it is a normal gameboy game.

As to the licensee codes I am a bit blank, if anyone can provide some documents on this I will add it to this section.

At offset 0146h is the Super gameboy function byte, set this byte to 03h will enable super gameboy functions, anything else and they are disabled.

The next byte is used to tell what sort of cartridge is installed.  The following table gives the byte and what facilities the cartridge has.

BYTE DESCRIPTION BYTE DESCRIPTION
00 ROM 12 ROM + MBC3 + RAM
01 ROM + MBC1 13 ROM + MBC3 + RAM + BATTERY
02 ROM + MBC1 + RAM 19 ROM + MBC5
03 ROM + MBC1 + RAM + BATTEY 1A ROM + MBC5 + RAM
05 ROM + MBC2 1B ROM + MBC5 + RAM + BATTERY
06 ROM + MBC2 + BATTERY 1C ROM + MBC5 + RUMBLE
08 ROM + RAM 1D ROM + MBC5 + RUMBLE + SRAM
09 ROM + RAM + BATTERY 1E ROM + MBC5 + RUMBLE + SRAM + BATTERY
0B ROM + MMMO1 1F POCKET CAMERA
0C ROM + MMMO1 + SRAM FD BANDAI TAMA5
0D ROM + MMMO1 + SRAM + BATTERY FE HUDSON HuC 3
0F ROM + MBC3 + TIMER + BATTERY FF HUDSON HuC 1
10 ROM + MBC3 + TIMER + RAM + BATTERY    
11 ROM + MBC3    


The byte at 0148 is the size of the ROM,  for a ROM bigger than 32k the second 16k of the ROM can be paged to any 16k chunk of the larger ROM.  On all but MBC5 cartridges paging in bank 0 to the upper 16k is the same as paging in bank 1, it is only the MBC5 cartridges that allow you to page in bank 0 to the upper ROM memory.  Byte 0149 is the amount of RAM the cartridge has, this memory is banked into locations A000 - BFFF (8k).  The following tables show the different values for these two bytes and the amount of ROM/RAM they corrispond to.

BYTE

ROM SIZE (in kilobits) ROM SIZE (in kilobytes) ROM SIZE (in banks)
00 256Kbit 32KByte 2 banks
01 512Kbit 64KByte 4 banks
02 1Mbit 128KByte 8 banks
03 2Mbit 256KByte 16 banks
04 4Mbit 512KByte 32 banks
05 8Mbit 1MByte 64 banks
06 16Mbit 2MByte 128 banks
52 9Mbit 1.1MByte 72 banks
53 10Mbit 1.2MByte 80 banks
54 12Mbit 1.5MByte 96 banks

BYTE

RAM SIZE (in kilobits) RAM SIZE (in kilobytes) RAM SIZE (in banks)
00 None None None
01 16Kbit 2KByte 1 banks
02 64Kbit 8KByte 1 banks
03 256Kbit 32KByte 4 banks
04 1Mbit 128KByte 16 banks

The value at offset 014A is the destination code, this is either 00 for Japanese or 1 for non-Japanese.  Following it is he old licensee code, for Super gameboy functions to work this needs to be 33h.  The Mask ROM version number is usually 00h.  The complement check and checksums are used to make sure that the header is valid, although the Nintendo logo is checked seperately.  Using a program such as RGBFix will calculate and set the checksum values for you.