Introduction
A .gba file is a copy of the ROM in a cartridge for Nintendo’s Game Boy Advance, for playing in an
emulator or writing to a flash cartridge. Like a Game Boy ROM there is no header added by the dumping tool: the file is
the ROM exactly, and the information an emulator needs is in the 192-byte header that every game already starts with.
The console’s processor is an ARM7TDMI (architecture ARMv4T), which runs both 32-bit ARM and 16-bit Thumb
instructions. The cartridge appears in the processor’s address space at 0x08000000.
Structure
The first word is one ARM instruction, a branch to the start of the program: the console’s BIOS shows the logo,
checks it, and then jumps to 0x08000000. The 156 bytes after it are the Nintendo logo, which the BIOS compares
with its own copy. Then come the game title, the game code, the maker code, a fixed byte 0x96, the
software version and a complement check at 0xBD over the bytes from 0xA0 to
0xBC. Every field is on the header page; the processor’s
memory map and its I/O registers
are what the code in the ROM talks to.
0x00entry point: an ARM branch4 bytes0x04Nintendo logo bitmap156 bytes0xA0game title, game code, maker code18 bytes0xB2fixed value 0x96, unit code, device type, reserved10 bytes0xBCsoftware version, complement check, reserved4 bytes0xC0the game’s code and data (a multiboot image uses the next 36 bytes for its own entry points)varies
The game’s save data is not described by the header. Games built with the Nintendo save library carry a text string
such as SRAM_V113, FLASH1M_V103 or EEPROM_V124 in the ROM, word-aligned, which
emulators search for to guess the backup memory; they are listed on the header page.
Not described
The header, the memory map and the I/O registers are written. What remains:
- Viewer: the explorer opens
.gbafiles: every header field decoded and checked (logo, the fixed byte, the complement check), the backup-media strings found in the ROM, the memory map, the registers, and the whole ROM disassembled for the ARM7TDMI (ARMv4T) with the entry branch followed and the registers named in references. Whether bytes are ARM or Thumb is not in the file, so a choice in the options bar says it (ARM, Thumb, or ARM then Thumb from an offset): that choice can never be made by the viewer. It does not follow code from the entry point (all bytes are decoded as instructions), does not separate code from data, does not read the multiboot header of a link-cable image, and does not give maker names. It has not been run in a browser by its author. - Reference: the BIOS calls, the registers’ bit fields, the DMA, timer and sound behaviour, the cartridge add-ons (real-time clock, solar sensor, rumble, gyro, tilt) and the flash and EEPROM command sets.
Links
Software
- mGBA – emulator for the Game Boy Advance, Game Boy and Game Boy Color (Windows, macOS, Linux)
- RetroArch – front end that plays them with a Game Boy Advance core (Windows, macOS, Linux, mobile)
- devkitPro – the toolchain homebrew games are built with; its
gbafixwrites the logo and the checksum (Windows, macOS, Linux)
Reference
- GBATEK – Martin Korth’s hardware reference; the sections “GBA Cartridge Header”, “GBA Memory Map” and “GBA I/O Map” are what these pages follow