Platform:Game Boy Advance/Save types
The GBA cartridge save chips (SRAM, Flash 64/128 KiB, EEPROM 512 B/8 KiB), the library version strings in the ROM that name them, and how mGBA and VBA-M decide which one a ROM uses.
GBA cartridges carry one of a few save memories. The .sav file an emulator writes is the raw chip content, so its size tells the type.
Chip types and file sizes
| Type | Chip | .sav size | Access |
|---|---|---|---|
| SRAM | battery SRAM | 32 KiB (0x8000) | direct byte reads/writes at 0x0E000000 |
| SRAM 64 KiB | (rare) | 64 KiB | same, mGBA names it SRAM512 (kilobit) |
| Flash 512 | 64 KiB flash | 64 KiB (0x10000) | command sequences at 0x0E005555 / 0x0E002AAA |
| Flash 1M | 128 KiB flash, two banks | 128 KiB (0x20000) | same, bank switch command 0xB0 |
| EEPROM 4K | 512 bytes | 512 B (0x200) | serial bits through the ROM space near 0x0D000000, normally by DMA3 |
| EEPROM 64K | 8 KiB | 8 KiB (0x2000) | same, 14-bit addresses |
See Fact:Game Boy Advance/enum/Save type sizes in mGBA. Note mGBA's names count kilobits for flash (FLASH512 is 64 KiB) but its EEPROM512 is 512 bytes.
Library strings in the ROM
Nintendo's save libraries leave an ASCII version string in the ROM; the prefix names the chip: EEPROM_Vnnn, SRAM_Vnnn, FLASH_Vnnn, FLASH512_Vnnn, FLASH1M_Vnnn (nnn = library version digits); SIIRTC_Vnnn marks the real-time-clock library. Emulators without a database scan the ROM for them. VisualBoyAdvance-M's flashDetectSaveType scans the ROM in 4-byte steps for EEPROM_, SRAM_, FLASH1M_ (128 KiB), FLASH512_ (64 KiB) and plain FLASH (treated as 64 KiB flash), with a fixed precedence, and SIIRTC_V for RTC. See Fact:Game Boy Advance/identification/Save type strings and VBA-M scan. Unverified: the exact digits that follow in each library release (for example FLASH1M_V102); test by running strings on ROMs and counting.
Detection by access (mGBA)
mGBA does not scan strings in the code paths read here: the save type starts as AUTODETECT and the first access decides. A write to the 0x0E000000 area at address 0x0E005555 (the first byte of a flash command sequence) selects Flash, any other first access there selects SRAM, and the first write into the ROM-mirror region used by EEPROM selects EEPROM. EEPROM starts as the 512-byte type and is promoted to 8 KiB the first time an address at or above 512 bytes is accessed. A per-game override database can force a type. See Fact:Game Boy Advance/behavior/mGBA save type autodetect.
Flash command protocol
Flash writes follow the usual JEDEC sequence: 0xAA to 0x5555, 0x55 to 0x2AAA, then a command byte to 0x5555: 0x80 erase prefix (followed by another 0xAA/0x55 and 0x10 chip erase or 0x30 sector erase), 0x90 chip-ID mode, 0xA0 program one byte, 0xB0 bank switch (1M flash), 0xF0 leave ID mode. mGBA's ID words: 0x1B32 (Panasonic MN63F805MNP) for 64 KiB and 0x1362 (Sanyo LE26FV10N1TS) for 128 KiB; other IDs defined there are 0x3D1F Atmel AT29LV512, 0x1CC2 and 0x09C2 Macronix, 0xD4BF SST 39LVF512. See Fact:Game Boy Advance/enum/Flash commands and chip IDs in mGBA.
Related
Format:Pokémon Generation 3 save file, Format:Game Boy Advance ROM image.
Code & repositories
- https://github.com/mgba-emu/mgba @
9660a668f2093cb4aba5983f52bebf8878dc5b8b· license: MPL-2.0
GBA/GB emulator (MPL-2.0). Read for SWI names (include/mgba/internal/gba/bios.h), HLE BIOS and decompressors (src/gba/bios.c), save chips (src/gba/savedata.c, memory.c) and ROM/multiboot detection (src/gba/gba.c).
Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-17; Note: the latest release ships binaries; the wiki links only the source, never the binaries - https://github.com/visualboyadvance-m/visualboyadvance-m @
4e9f929cb8e3f2929ffdd7ec48c8ec4ebf659e34· license: GPL-2.0-only (declared by the contributor for the files used; GitHub reports GPL-2.0 for the repository)
GBA/GB emulator (GPL-2.0). src/core/gba/gbaFlash.cpp flashDetectSaveType scans the ROM for save library strings.
Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-19; Note: the latest release ships binaries; the wiki links only the source, never the binaries
Evidence & references
mGBA (MPL-2.0) at commit 9660a668f2093cb4aba5983f52bebf8878dc5b8b; VisualBoyAdvance-M (GPL-2.0) at commit 4e9f929cb8e3f2929ffdd7ec48c8ec4ebf659e34.