Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Game Boy Advance ROM image

From ReverseEngineering.wiki
Format
Platforms Platform:Game Boy Advance
Magic 0x96 at offset 0xB2; logo bytes 24 FF AE 51 at offset 4
Extensions gba
Endianness little
On this wiki Facts · Code · Notes · Topics

Raw cartridge dump of a Game Boy Advance game (.gba): a 192-byte header at offset 0 (ARM branch, 156-byte Nintendo logo, 12-byte title, 4-character game code, 2-character maker code, fixed byte 0x96, version and a header complement check) followed directly by ARM/Thumb code and data, mapped at 0x08000000.

Header layout

The ROM is the cartridge contents byte for byte; offset N is address 0x08000000 + N. The header, as defined by the gbafix tool bundled in the pret decompilations:

Offset Size Field
0x00 4 start code: an ARM B instruction (EA00002E in the stock header: branch to 0xC0)
0x04 156 Nintendo logo bitmap data (starts 24 FF AE 51 69 9A A2 21)
0xA0 12 game title, ASCII, NUL padded
0xAC 4 game code, e.g. BPEE (Pokémon Emerald); first letter is the category (A/B = game, F = Classic NES), last is the region (E USA, J Japan, P Europe)
0xB0 2 maker code, e.g. 01 (Nintendo)
0xB2 1 fixed value 0x96
0xB3 1 main unit code, 0
0xB4 1 device type, 0
0xB5 7 reserved zero
0xBC 1 software version
0xBD 1 header complement check
0xBE 2 reserved zero

The complement check (gbafix HeaderComplement) is -(0x19 + sum of bytes 0xA0..0xBC) truncated to 8 bits. The logo is the same in every licensed game, so 24 FF AE 51 at offset 4 is a reliable test for a GBA ROM. There is no checksum of the body in the header.

A debug-enable flag exists in the logo area: gbafix sets byte 0x9C of the header to 0xA5 (logo offset 0x98) when asked for a debug build.

Identifying a build

Game code plus software version at 0xBC identify the release, but the reliable identity is the SHA-1 of the file, which the decompilation projects publish (pokeemerald: f3ae088181bf583e55daf962a92bb46f4f1d07b7).

Entry

The branch at 0 leads to the crt0 (in pokeemerald src/crt0.s: Init sets IRQ and system mode stacks, installs IntrMain at the interrupt vector, then calls AgbMain and loops back to Init).

Detection by emulators and multiboot

mGBA (GBAIsROM, src/gba/gba.c lines 695-751 at commit 9660a668f2093cb4aba5983f52bebf8878dc5b8b) accepts a file as a GBA ROM when byte 3 is 0xEA (the condition-always ARM B opcode) and byte 0xB2 is 0x96; if 0xB2 is not 0x96 it still accepts the file when bytes 4-0x9F (the logo area) are all zero, meaning an unfixed ROM that gbafix has not completed yet. The logo bytes themselves are not compared.

A multiboot image (loaded over the link cable into EWRAM at 0x02000000, entry 0x020000C0) is recognised by GBAIsMB (lines 754-790): the file must be at most 256 KiB (EWRAM size), and the word at 0xC0 must decode as an ARM branch whose displacement is not zero and not 24 words (a branch with immediate 24 is what a normal cartridge header at 0xC0 starts with; 28 is rejected as an old toolchain quirk). Multiboot images use the same 0xC0-byte header; the words at 0xC0 onward are the multiboot header (boot mode, slave ID) and code. Unverified: the exact layout of the multiboot fields after 0xC0 (boot mode byte at 0xC4, slave ID at 0xC5); take it from a documentation source such as tonc or GBATEK and test with a multiboot ROM. The ROM header also leaves the BIOS call MultiBoot as Platform:Game Boy Advance/BIOS calls 0x25.

Save memory is not described in the header; see Platform:Game Boy Advance/Save types for the library strings that name it.

Code & repositories

  • https://github.com/pret/pokeemerald @ 731ad5bfd6e6f265508d0efcca0ba42f9dcf5881 · license: none
    Matching decompilation of Pokemon Emerald (BPEE) for the Game Boy Advance. Useful without building: Makefile (header values, agbcc flags), rom.sha1, ld_script.ld (link order), src/crt0.s, tools/gbafix/gbafix.c (header layout and complement check).
    Tested on: source read, not run: Read at commit 731ad5b: Makefile, README, crt0.s, gbafix.c; not built · checked 2026-10-18; last activity 2026-10-01; no license: not reusable