rgbfix(1) — Game Boy header utility and checksum fixer
rgbfix program changes headers of Game
Boy ROM images, typically generated by
rgblink(1), though it will work with
any Game Boy
ROM. It also performs other correctness operations, such as padding.
rgbfix only changes the fields for which it has
values specified. Developers are advised to fill those fields with 0x00
bytes in their source code before running
and to have already populated whichever fields they don't specify using
Note that options can be abbreviated as long as the abbreviation
invalid because it could also be
Options later in the command line override those set earlier. Accepted
options are as follows:
- Set the Game Boy Color–only flag (0x143) to
0xC0. This overrides
-cif it was set prior.
- Set the Game Boy Color–compatible flag:
(0x143) to 0x80. This overrides
-cif it was set prior.
- Fix certain header values that the Game Boy checks for correctness. Alternatively, intentionally trash these values by writing their binary inverse instead. fix_spec is a string containing any combination of the following characters:
- Set the game ID string (0x13F–0x142) to a given string. If it's longer than 4 chars, it will be truncated, and a warning emitted.
- Set the non-Japanese region flag (0x14A) to 0x01.
- Set the new licensee string (0x144–0x145) to a given string. If it's longer than 2 chars, it will be truncated, and a warning emitted.
- Set the old licensee code (0x14B) to a given value from 0 to 0xFF. This value is deprecated and should be set to 0x33 in all new software.
- Set the MBC type (0x147) to a given value from 0 to 0xFF. This value may also be an MBC name from the Pan Docs.
- Set the ROM version (0x14C) to a given value from 0 to 0xFF.
- Pad the ROM image to a valid size with a given pad value from 0 to 255
rgbfixwill automatically pick a size from 32 KiB, 64 KiB, 128 KiB, ..., 8192 KiB. The cartridge size byte (0x148) will be changed to reflect this new size. The recommended padding value is 0xFF, to speed up writing the ROM to flash chips, and to avoid "nop slides" into VRAM.
- Set the RAM size (0x149) to a given value from 0 to 0xFF.
- Set the SGB flag (0x146) to 0x03. This flag will
be ignored by the SGB unless the old licensee code is 0x33! If this is
given as well as
-l, but is not set to 0x33, a warning will be printed.
- Set the title string
(0x134–0x143) to a
given string. If the title is longer than the max length, it will be
truncated, and a warning emitted. The max length is 11 characters if the
game ID (
-i) is specified, 15 characters if the CGB flag (
-C) is specified but the game ID is not, and 16 characters otherwise.
- Print the version of the program and exit.
- Equivalent to
Most values in the ROM header do not matter to the actual console, and most are seldom useful anyway. The bare minimum requirements for a workable program are the header checksum, the Nintendo logo, and (if needed) the CGB/SGB flags. It is a good idea to pad the image to a valid size as well (“valid” meaning a power of 2, times 32 KiB).
The following will make a plain, non-color Game Boy game without checking for a valid size:
The following will make a SGB-enabled, color-enabled game with a title of “foobar”, and pad it to a valid size. (The Game Boy itself does not use the title, but some emulators or ROM managers do.)
The following will duplicate the header of the game “Survival Kids”, sans global checksum:
Please report bugs on GitHub.
rgbfix was originally released by Carsten
Sørensen as a standalone program called gbfix, and was later packaged
in RGBDS by Justin Lloyd. It is now maintained by a number of contributors