rgblink(1) — Game Boy linker
ROM0 sections are placed in the first 16 KiB of the output ROM,
and ROMX sections are placed in any 16 KiB “bank” except the
first. If your ROM will only be 32 KiB, you can use the
-t option to change this.
Similarly, WRAM0 sections are placed in the first 4 KiB of WRAM
(“bank 0”), and WRAMX sections are placed in any bank of the
last 4 KiB. If your ROM doesn't use banked WRAM, you can use the
-w option to change this.
Also, if your ROM is designed for a monochrome Game Boy, you can
make sure that you don't use any incompatible section by using the
-d option, which implies
but also prohibits the use of banked VRAM.
Note that options can be abbreviated as long as the abbreviation
invalid because it could also be
arguments are as follows:
- Enable DMG mode. Prohibit the use of sections that doesn't exist on a DMG,
such as WRAMX and VRAM bank 1. This option automatically enables
- Specify a linker script file that tells the linker how sections must be placed in the ROM. The attributes assigned in the linker script must be consistent with any assigned in the code. See rgblink(5) for more information about the linker script format.
- Write a map file to the given filename, listing how sections and symbols were assigned.
- Write a symbol file to the given filename, listing the address of all exported symbols. Several external programs can use this information, for example to help debugging ROMs.
- If specified, sections will be overlaid "on top" of the provided ROM image. In that case, all sections must be fixed. This may be used to patch an existing binary.
- Write the ROM image to the given file.
- When inserting padding between sections, pad with this value. Has no
-Ois specified. The default is 0.
- This option is ignored. It was supposed to perform smart linking but fell into disrepair, and so has been removed. It will be reimplemented at some point.
- Expand the ROM0 section size from 16 KiB to the full 32 KiB assigned to ROM and prohibit the use of ROMX sections. Useful for ROMs that fit in 32 KiB.
- Print the version of the program and exit.
- Verbose: enable printing more information to standard error.
- Expand the WRAM0 section size from 4 KiB to the full 8 KiB assigned to WRAM and prohibit the use of WRAMX sections.
All you need for a basic ROM is an object file, which can be made into a ROM image like so:
The resulting bar.gb will not have correct checksums (unless you put them in the assembly source). You should use rgbfix(1) to fix these so that the program will actually run in a Game Boy:
$ rgbfix -v bar.gb
Here is a more complete example:
$ rgblink -o bin/game.gb -n bin/game.sym -p 0xFF obj/title.o obj/engine.o
Please report bugs on GitHub.
rgblink was originally written by Carsten
Sørensen as part of the ASMotor package, and was later packaged in
RGBDS by Justin Lloyd. It is now maintained by a number of contributors at