rgbfix(1) — Game Boy checksum fixer
rgbfix program changes headers of Game
Boy ROM images. It also performs other filetype operations, such as
truncation. The arguments are as follows:
- Set the Game Boy Color–only flag: 0x143 =
0xC0. If both this and the
-cflag are set, this takes precedence.
- Set the Game Boy Color–compatible flag:
0x143 = 0x80. If both this and the
-Cflag are set,
- Set the game ID string (0x13F–0x142) to a given string of exactly 4 characters. If both this and the title are set, the game ID will overwrite the overlapping portion of the title.
- Set the non-Japanese region flag: 0x14A = 1.
- Set the new licensee string (0x144–0x145) to a given string, truncated to at most two characters.
- 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.
- Set the ROM version, 0x14C, to a given value from 0 to 0xFF.
- Pad the image to a valid size with a given pad value from 0 to 0xFF.
rgbfixwill automatically pick a size from 32KiB, 64KiB, 128KiB, ..., 8192KiB and give a warning thereafter. The cartridge size byte (0x148) will be changed to reflect this new size.
- Set the RAM size, 0x149, to a given value from 0 to 0xFF.
- Set the SGB flag: 0x146 = 3.
- Set the title string
(0x134–0x143) to a
given string, truncated to at most 16 characters. It is recommended to use
15 characters instead, to avoid clashing with the CGB flag
-C). If both this and the game ID are set, the game ID will overwrite the overlapping portion of the title.
- Validate the header and fix checksums: the Nintendo character area (0x104–0x133), the header checksum (0x14D), and the global checksum (0x14E–0x14F).
Most values in the ROM header are only cosmetic. The bare minimum requirements for a workable image are checksums, 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 multiple of 32KiB).
The following will make a plain, no-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 multiple of 32KiB. (The Game Boy itself does not use the title, but some emulators or ROM managers might.)
The following will duplicate the header (sans global checksum) of the game “Survival Kids”:
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