The processor sees 32 KiB of ROM, but a cartridge can hold up to 8 MiB. A memory bank controller (MBC) on the
cartridge decides which 16 KiB bank appears at $4000–$7FFF. The program talks to it by
writing to the ROM area: ROM cannot be written, so the write goes to the controller. The
cartridge type in the header says which controller is fitted. Every register is
write-only. The tables below are from Pan Docs, each section re-read from the raw Markdown file named in it on 2026-11-14 (CC0; copies in the site’s sample sources); the viewer shows the
same register table for the controller named in the header. Where a section rests on one source only, it says so. Two general rules from Pan Docs’ MBCs.md:
- Double speed. Among Nintendo’s controllers only the MBC5 is guaranteed by Nintendo to cope with the Game Boy Color’s double-speed timing; rumours said MBC1 to MBC3 might be too slow (a home-made MBC1 and EPROM cartridge appeared to work stably in double speed). Code and data in internal RAM can avoid the issue.
- Unmapped RAM banks. In most controllers, selecting a RAM bank beyond the RAM that exists makes the controller wrap the address, so the byte accessed is at
((address − external RAM start) + (active RAM bank × RAM bank size)) mod max external RAM size.
(Pan Docs’ other statement, that the Game Boy Color double-speed guarantee is for MBC5 only, is the source of the codes page’s remark on type 0x19.)
MBC1
Source: raw Pan Docs MBC1.md (and othermbc.md for the board note). Up to 2 MiB of ROM and/or 32 KiB of RAM. In the default wiring it supports 512 KiB of ROM with up to 32 KiB of banked RAM;
on other wiring the 2-bit register extends the ROM number instead of the RAM, for up to 2 MiB of ROM with a fixed 8 KiB of RAM. All MBC1 cartridges with 1 MiB of ROM or more use the alternate wiring.
Available RAM is 8 KiB, or 32 KiB as four 8 KiB banks (32 KiB only with ROM of 512 KiB or less). All registers are $00 at power-up, which for the ROM bank number is treated as $01.
| Write to | Register | Effect |
|---|---|---|
$0000–$1FFF | RAM enable | A $A in the low 4 bits enables the external RAM; any other value disables it. Pan Docs recommends disabling RAM after use to protect it when the console is switched off or the cartridge removed; once the cartridge has completely lost power the RAM is disabled automatically. |
$2000–$3FFF | ROM bank number | 5 bits ($01–$1F); higher bits of the written value are discarded ($E1 selects bank $01). $00 acts as $01. The value is also masked to the number of bits the cartridge needs (a 256 KiB cartridge has 16 banks, so 4 bits). The 0→1 test uses the whole 5-bit register, so on cartridges of 256 KiB or less writing $10 prevents the translation while the used bits are all 0, and bank 0 appears at $4000. |
$4000–$5FFF | RAM bank / upper ROM bank | 2 bits: the RAM bank $00–$03 on 32 KiB RAM cartridges, bits 5–6 of the ROM bank on cartridges of 1 MiB or more; if neither ROM nor RAM is large enough, no effect. |
$6000–$7FFF | Banking mode select | 1 bit. Mode 0 (simple, default) keeps $0000–$3FFF on ROM bank 0 and $A000–$BFFF on RAM bank 0; mode 1 (advanced) lets the 2-bit register switch those as well. On a cartridge with ≤ 8 KiB of RAM and ≤ 512 KiB of ROM the mode select has no observable effect. The program may switch modes at any time. |
What each area reads
$0000–$3FFF: normally bank 0. On 1 MiB and larger cartridges, mode 1 lets the 2-bit register apply here too, reaching banks$20,$40,$60(MBC1M:$10,$20,$30).$4000–$7FFF: bank = (2-bit register << 5) + 5-bit register. The 0→1 translation ignores the two extra bits, so banks$20,$40and$60cannot be reached here: they read as$21,$41,$61(MBC1M:$10,$20,$30read as$11,$21,$31; and$00reads as$01). The only way to reach$20,$40,$60is mode 1 at$0000, which has its own problem: that range holds the interrupt handlers, so the trick is mostly used by multi-game cartridges.$A000–$BFFF: RAM, only if enabled; otherwise reads return open-bus values (often$FF, not guaranteed) and writes are ignored. External RAM is no slower than internal RAM, so games use part of it as extra work RAM.
Why mode 1 works (Pan Docs): the chip has AND gates between both bank registers and the second-highest address bit. Accesses to $0000–$3FFF (that address bit 0) see the registers as 0. When the 2-bit register is wired to RAM, the same gate locks RAM to bank 0, because $A000–$BFFF also has that address bit 0. Mode 1 switches the gates off.
Addressing diagrams
Address bits of the ROM or RAM chip, from the raw file’s diagrams (“From GB” means the Game Boy address bits; “B2” the 2-bit register at $4000; “B5” the 5-bit register at $2000). In a smaller cartridge some upper bits are ignored (128 KiB uses bits 0–16).
| Area | Mode | ROM or RAM address bits (high to low) |
|---|---|---|
ROM $0000–$3FFF | 0 | bits 20–19: 0; bits 18–14: 0; bits 13–0: From GB |
ROM $0000–$3FFF | 1 | bits 20–19: B2; bits 18–14: 0; bits 13–0: From GB |
ROM $4000–$7FFF | 0 or 1 | bits 20–19: B2; bits 18–14: B5; bits 13–0: From GB |
RAM $A000–$BFFF | 0 | bits 14–13: 0; bits 12–0: From GB |
RAM $A000–$BFFF | 1 | bits 14–13: B2; bits 12–0: From GB |
MBC1M: 1 MiB multi-game cartridges
Sources: MBC1.md (the MBC1M section) and othermbc.md. An MBC1M board uses the MBC1 chip but does not connect the chip’s A18 output to the ROM, so several 2 Mbit (16-bank) games fit and the SRAM bank select at $4000 chooses
one of up to four. (In theory a board could do the same for 1 Mbit or 512 kbit games by also leaving A17 and A16 unconnected, but this does not appear to have been done in licensed games.) The top bit of the 5-bit ROM register is ignored (effectively 4 bits; the whole 5 bits still take part in the 0→1 translation)
and the 2-bit register applies to bits 4–5 of the bank number. In mode 1 it therefore selects banks $00, $10, $20, $30 at $0000. The compilation uses mode 1 to switch games: the 2-bit register
selects the game, and the game changes only the main ROM register; as far as it knows it runs from a 256 KiB cartridge.
| Area | Mode | ROM address bits (high to low) |
|---|---|---|
$0000–$3FFF | 0 | bits 19–18: 0; bits 17–14: 0; bits 13–0: From GB |
$0000–$3FFF | 1 | bits 19–18: B2; bits 17–14: 0; bits 13–0: From GB |
$4000–$7FFF | 0 or 1 | bits 19–18: B2; bits 17–14: B5 (its bit 4 unused); bits 13–0: From GB |
Identification (Pan Docs). Such a cartridge can normally be recognised by a Nintendo copyright header in bank $10. A badly dumped multi-cart ROM shows duplicate content in banks $10–$1F (a copy of $00–$0F) and in $30–$3F (a copy of $20–$2F); Pan Docs says a known bad dump of the Mortal Kombat I & II collection exists.
Conversion. An MBC1M ROM can be turned into a regular MBC1 ROM by growing it to 2 MiB and duplicating each sub-ROM: $00–$0F into $10–$1F, the original $10–$1F placed at $20–$2F and copied to $30–$3F, and so on.
Evidence: one source, Pan Docs (itself from community research); the MBC1 rules were not tested on hardware here.
MBC2
Source: raw Pan Docs MBC2.md (one source). Up to 256 KiB of ROM and 512 × 4 bits of RAM. Registers at $0000–$3FFF; bit 8 of the address (the lowest bit of the upper address byte) picks the function.
Examples that control RAM: $0000–$00FF, $0200–$02FF … $3E00–$3EFF; that control the ROM bank: $0100–$01FF, $0300–$03FF … $3F00–$3FFF.
| Write to | Register | Effect |
|---|---|---|
| address bit 8 clear | RAM enable | RAM is enabled if and only if the low 4 bits of the value are $A; any other value disables it. Disabled at power-on. |
| address bit 8 set | ROM bank number | Low 4 bits, so banks 0–15 (256 KiB at most); 0 selects bank 1. Bank 1 at power-on. |
The MBC2 has no external RAM; it has 512 half-bytes built into the chip at $A000–$A1FF, and it still needs an external battery to keep them when the console is off.
Only the low 4 bits of each byte are used; the upper 4 bits are undefined and must not be relied on. $A200–$BFFF holds 15 “echoes” of $A000–$A1FF:
only the bottom 9 bits of the address index the RAM, so access repeats, with the same undefined upper nybble. The ROM area $4000–$7FFF holds banks $01–$0F (16 banks in all).
(Our reading, not a Pan Docs statement: the MBC2 has no RAM bank register, so the unmapped-bank wrap formula above has nothing to act on there.)
MBC3
Source: raw Pan Docs MBC3.md (one source). Up to 2 MiB of ROM (128 banks), 32 KiB of RAM (4 banks of 8 KiB; the register accepts $00–$07) and a real-time clock (RTC). The clock needs an external 32.768 kHz crystal and an external battery to keep ticking while the console is off.
Unlike MBC1, ROM banks $20, $40 and $60 can be selected at $4000.
| Write to | Register | Effect |
|---|---|---|
$0000–$1FFF | RAM and timer enable | $0A enables reading and writing of the external RAM and the clock registers; $00 disables both (Pan Docs: “mostly the same as for MBC1”). |
$2000–$3FFF | ROM bank number | The whole 7 bits are written directly; $00 selects bank $01; $01–$7F select those banks. |
$4000–$5FFF | RAM bank / clock register select | $00–$07 the corresponding RAM bank; $08–$0C the corresponding clock register, reachable by reading or writing any address in $A000–$BFFF (typically $A000). |
$6000–$7FFF | Latch clock data | Writing $00 then $01 latches the current time into the clock registers. The latched values do not change until the next $00, $01 latch, so the registers can be read while the clock keeps ticking. |
| Register | Name | Contents | Range |
|---|---|---|---|
$08 | RTC S | Seconds | 0–59 ($00–$3B) |
$09 | RTC M | Minutes | 0–59 ($00–$3B) |
$0A | RTC H | Hours | 0–23 ($00–$17) |
$0B | RTC DL | Lower 8 bits of the day counter | $00–$FF |
$0C | RTC DH | Bit 0: most significant bit (bit 8) of the day counter. Bit 6: halt (0 = active, 1 = stop timer). Bit 7: day counter carry (1 = counter overflow). |
Halt. The halt flag is supposed to be set before writing to the clock registers. The day counter is 9 bits in total, counting days 0–511 ($000–$1FF). When it overflows the carry bit is set, and
it stays set until the program resets it. Pan Docs suggests keeping an offset in battery RAM: whenever a non-zero day counter is read, add it to the stored offset and reset the counter to zero, which counts any number of days as long as the cartridge is used at least every 511 days.
Delay. When accessing the clock registers, Pan Docs recommends waiting 4 µs (4 M-cycles in normal speed) between separate accesses.
MBC30
Source: MBC3.md (the MBC30 section) and the footnote in The_Cartridge_Header.md; one source. The MBC30 is practically identical to the MBC3 in operation, but addresses twice as much memory for both ROM and RAM: 4 MiB of ROM and 64 KiB of RAM, with the timer.
The only title shipped with it was Pocket Monsters: Crystal Version in Japan; the worldwide versions of the game use the MBC3. In the header there is no separate type code: it appears as the MBC3 types
0x10, 0x12 and 0x13 (see the codes page). The explorer reports the controller as MBC30 when one of these types is combined with RAM size code 0x05 (64 KiB) or a ROM larger than 2 MiB, and the MBC3 register table above applies.
Pan Docs does not say how many bits the MBC30’s ROM and RAM bank registers have. Three emulators agree on the widths (read in their raw source files, kept in samples/gb/sources; none is hardware documentation): the ROM bank register is the whole 8 bits written to $2000–$3FFF (an MBC3 keeps 7), and the RAM bank register accepts 3 bits (banks 0–7, 8 × 8 KiB = 64 KiB; an MBC3 keeps 2).
| Emulator (source file) | When it treats the cartridge as MBC30 | ROM bank | RAM bank |
|---|---|---|---|
Gambatte, pokemon-speedrunning fork (cartridge.cpp, mbc.h) | type $0F–$13 with more than 128 ROM banks or more than 4 RAM banks | Mbc30 passes mask $FF | mask $07 (MBC3: $7F and $03); with a clock the RAM bank register keeps 4 bits so $08–$0C select the clock |
SameBoy (Core/mbc.c, memory.c) | MBC3 with ROM over 2 MiB or RAM over 32 KiB | the byte is masked with $7F unless MBC30 | the byte is stored; bit 3 selects the clock |
mGBA (src/gb/mbc/mbc.c, _GBMBC3) | no separate type; ROM at least 2 MiB (128 banks × 16 KiB) | masked with $7F only when the ROM is smaller than 2 MiB | the low 4 bits decide RAM bank (below 8) or clock register ($08–$0C) |
So the explorer’s range (ROM banks $01–$FF) and the 3-bit RAM bank are the emulators’ widths, which follow the 4 MiB and 64 KiB sizes; no Nintendo document gives them (none was found). Gekkio’s reference (below) gives the sizes the widths follow from, 256 ROM banks and 8 RAM banks, from its own chip research, so “how many bits does the real chip have” is an inference from those sizes and the three emulators, with a second source for the sizes.
Game ROM analysis: Pocket Monsters Crystal JP, call sites of $2F9D
Evidence kind: game ROM analysis (static disassembly of a shipped cartridge image decoded with the explorer’s own SM83 decoder; the game was not run). The ROM is Pocket Monsters – Crystal Version (Japan), 2 MiB, header type $10 (MBC3 + timer + RAM + battery), ROM size code $06, RAM size code $05 (64 KiB, eight banks of 8 KiB). Two small routines in bank 0 do the cartridge RAM opening and closing of the game:
| Address (bank 0) | Code | What it does |
|---|---|---|
$2F9D (open) | push af; ld a,$01; ld ($6000),a; ld a,$0A; ld ($0000),a; pop af; ld ($4000),a; ret | writes $01 to the latch range $6000–$7FFF, writes $0A to the RAM gate, then writes the caller’s A to the RAM bank register at $4000–$5FFF |
$2FAD (close) | push af; ld a,$00; ld ($6000),a; ld ($0000),a; pop af; ret | writes $00 to the latch range and $00 to the RAM gate |
Result of the sweep (every 16 KiB bank decoded linearly; script scripts/gb/fix26a-sram-callers.mjs, output kept in samples/gb/emulator-results/gamerom-crystal-jp-sram-banks-fix26a.txt; the earlier byte-pattern run, gamerom-crystal-jp-sram-banks-fix25.txt, found the same 310 calls): there are 310 call $2F9D instructions. In 281 of them the value of A is a constant known from the code before the call (268 directly after ld a,n, 13 over instructions that do not change A); the other 29 take A from memory or a register (a table, the caller’s argument) and cannot be read statically. The constants are the RAM bank numbers written to $4000; addresses are ROM bank in hex, then the address in the bank:
| RAM bank written | Call sites | Examples (ROM bank:address) |
|---|---|---|
| 0 | 53 | 00:0272, 00:06C8, 01:5C38 |
| 1 | 63 | 01:5BF4, 03:5D96, 05:4B55 |
| 2 | 0 | none found among the constants |
| 3 | 10 | 05:4E11, 05:4E24, 05:5052 |
| 4 | 25 | 05:4CC7, 05:4D50, 13:695B, 40:4702, 41:582B, 47:420E |
| 5 | 105 | 05:4D0B, 0F:41C1, 41:5F6F, 46:418C, 47:4002 |
| 6 | 15 | 46:537C, 5F:5399, 7D:4002, 7D:4DBD |
| 7 | 10 | 05:4D77, 12:5D3F, 40:506A, 45:7CED |
Several of the sites for banks 4 to 7 were checked by disassembling around them and are real code, not data swept as code: at 05:4CC5 ld a,$04; call $2F9D; ld hl,$4CD9; ld de,$A007; ld bc,$0030 (a copy into bank 4); at 05:4D75 ld a,$07; call $2F9D; xor a; ld ($A000),a; call $2FAD; ret (zero to the first byte of bank 7, then close); at 12:5D3D ld a,$07; call $2F9D; ld a,($A000); call $2FAD (reads the first byte of bank 7); at 46:537A ld a,$06; call $2F9D; ld hl,$D002; at 40:46FD ld a,$04; ld hl,$A800; call $2F9D; xor a; ld (hl+),a three times; call $2FAD.
What this settles: the Japanese Crystal cartridge selects RAM banks 4, 5, 6 and 7 through the RAM bank register, so the 64 KiB of RAM on the MBC30 board is used as eight banks by a shipped game and the register is used with values up to $07. Together with the header’s RAM size code $05 and the MBC30 RAM size of eight banks (Pan Docs, gb-ctr), the usable RAM bank width of 3 bits is therefore a fact of the game and not only an emulator reading. Caveats: this is static analysis of one game image; it does not show which call sites run in play, and the 29 sites whose A is not constant could use other values (for example 2) or the same ones. The sweep decodes each bank linearly, so some bytes it reports as calls could be data (only the examples above were checked by disassembly). A game that uses banks 0 to 7 cannot show whether the chip’s register is physically wider than 3 bits. The ROM bank writes of the game were not analysed, so the 8-bit ROM bank width still rests on the three emulators and the 256-bank size. The round 24 scan of constant stores to $4000 found no value 4 to 7 in this ROM, which fits this result because the game writes the bank through the routine at $2F9D from register A, not by constant stores. The Gin, Kin and Crystal (USA) images were scanned the same way as that round 24 scan and show constant bank writes of 0 to 3 only, matching their RAM size code $03 (32 KiB).
MBC5
Source: raw Pan Docs MBC5.md (one source). The fifth-generation controller (MBC4 was not used in any released cartridge), mapping up to 64 Mbit (8 MiB) of ROM and RAM of 8 KiB, 32 KiB or 128 KiB. It is the first MBC guaranteed to work with the Game Boy Color’s double-speed mode.
ROM bank $00–$1FF at $4000, and bank 0 really is bank 0 here, unlike the other controllers.
| Write to | Register | Effect |
|---|---|---|
$0000–$1FFF | RAM enable | $0A enables, $00 disables. Pan Docs adds that real chips enable the RAM for any value whose low 4 bits are $A ($0A, $1A …) and disable it for anything else, but advises against relying on that. Disputed: Gekkio’s reference, SameBoy, Mesen 2 and mGBA enable only for $0A; see the second reference. |
$2000–$2FFF | ROM bank, low 8 bits | Writing 0 gives bank 0, unlike other controllers. |
$3000–$3FFF | ROM bank, ninth bit | Up to 512 banks (8 MiB). |
$4000–$5FFF | RAM bank | $00–$0F maps that external RAM bank (if any) at $A000–$BFFF; on cartridges with a rumble motor, bit 3 drives the motor (below). |
Rumble. On cartridges with a motor, bit 3 of the RAM bank register is connected to the rumble circuit instead of the RAM chip. Setting it to 1 turns the motor on and keeps it on until the bit is cleared. To control intensity, switch it on and off repeatedly; Pan Docs shows two waveforms from Pokémon Pinball (mild and strong). (Our inference, not stated by Pan Docs: with a motor fitted only bits 0–2 can select a RAM bank.)
The two rumble waveforms in numbers
The two drawings are plots of oscilloscope measurements of the voltage across the motor of a cartridge running Pokémon Pinball. Pan Docs keeps the measurements as two CSV files (src/imgs/src/MBC5_Rumble_Mild.csv and MBC5_Rumble_Strong.csv, “Time (ms)” and “Rumble Motor (V)”, 4,887 samples each, one sample every 0.0205 ms from −10.05 ms to +90.02 ms); both were fetched raw (samples/gb/sources/pandocs-more) and summarised by scripts/gb/rumble-summary.mjs, which calls the motor “on” when the voltage is above the midpoint of its range. Time 0 is the first rising edge. The numbers below are measured values, not specified timings; Pan Docs does not say what the game wrote to the register (we infer a write of bit 3 at a frame boundary, from the 16.7 ms steps of the strong trace; our reading).
| Trace | Voltage range | Segments (start to end in ms: on or off, length) | Pattern |
|---|---|---|---|
| Mild | 0.08 V to 1.45 V | 0.01–9.39 on (9.38); 9.39–33.47 off (24.08); 33.47–42.87 on (9.40); 42.87–68.47 off (25.60); 68.47–76.36 on (7.88); 76.36–90.02 off (13.66) | a pulse about 9.4 ms long about every 34 ms (the on part is a little over half a 16.7 ms frame; the third pulse is shorter, 7.9 ms) |
| Strong | 0.01 V to 1.48 V | 0.01–16.74 on (16.73); 16.74–33.49 off (16.75); 33.49–51.72 on (18.23); 51.72–66.98 off (15.26); 66.98–83.71 on (16.73); 83.71–90.02 off (6.31) | on and off in turn, each about 16.7 ms, which is one frame at 59.7 Hz (the longest segment is 18.2 ms) |
In words: the mild effect keeps the motor on for roughly 28 % of the time (a short pulse every other frame), the strong effect for roughly 50 % (on for one frame, off for the next). The drawings add nothing beyond these numbers, apart from the rise and fall times of the voltage, which the summary does not describe.
MBC6
Used by one game, with an 8 Mbit flash chip besides ROM and RAM. Both ROM windows are 8 KiB.
| Write to | Register | Effect |
|---|---|---|
$0000–$03FF | RAM enable | $0A enables, $00 disables. |
$0400–$07FF | RAM bank A | Bank for $A000–$AFFF (4 KiB, banks 0–7). |
$0800–$0BFF | RAM bank B | Bank for $B000–$BFFF. |
$0C00–$0FFF | Flash enable | Bit 0. |
$1000 | Flash write enable | Bit 0; controls sector 0 and the hidden region. |
$2000–$27FF | ROM/flash bank A number | For $4000–$5FFF (8 KiB, banks 0–$7F). |
$2800–$2FFF | Bank A select | $00 ROM, $08 flash. |
$3000–$37FF | ROM/flash bank B number | For $6000–$7FFF. |
$3800–$3FFF | Bank B select | $00 ROM, $08 flash. |
The game is Net de Get: Minigame @ 100, which downloads mini-games through the Mobile Adapter into the flash. Both ROM windows
and both RAM windows are views of the same ROM and RAM with separate offsets, so there are twice as many (half-size) banks as usual: 8 KiB
ROM banks and 4 KiB RAM banks. Bank A is $4000–$5FFF and bank B $6000–$7FFF; each can show
ROM or flash banks $00–$7F. The flash can be written, ROM cannot. The RAM bank registers choose banks 0–7.
The flash chip
The chip is an 8 Mbit Macronix MX29F008TC-14: 1 MiB in eight sectors of 128 KiB, plus a hidden region of 256 bytes.
The flash is mapped straight into window A or B, so it takes the usual flash command sequences. Enable it first with the flash
enable register (bit 0; with it off the chip’s chip-enable signal stays off). Every command begins with two unlock writes: $AA
to address $5555 and $55 to address $2AAA of the flash. Through the windows these are written as
$AA to flash bank 2 at offset $1555 (CPU address $5555 in window A, $7555 in window B) and $55
to flash bank 1 at offset $0AAA (CPU $4AAA in A, $6AAA in B). In the table X is 4 (window A) or 6 (window B) and
Y is 5 or 7. The final byte of a command is written to 2:Y555 unless stated.
| Command | Sequence after the two unlock writes | Needs flash write enable |
|---|---|---|
Erase sector (sets 128 KiB to $FF) | 2:Y555=$80, unlock again, then $30 written to any address inside the sector to erase | Sector 0 only |
Erase chip (all 1 MiB to $FF) | 2:Y555=$80, unlock again, 2:Y555=$10 | Skips sector 0 while it is protected |
| Erase hidden region (256 bytes) | 2:Y555=$60, unlock again, 2:Y555=$04 | Yes |
| ID mode | 2:Y555=$90; the JEDEC ID C2 81 reads at $XXX0, $XXX1 | No |
| Read hidden region | 2:Y555=$77, unlock again, 2:Y555=$77 | No |
| Program mode | 2:Y555=$A0 | Sector 0 only |
| Program mode, hidden region | 2:Y555=$60, unlock again, 2:Y555=$E0 | Yes |
| Unprotect sector 0 | 2:Y555=$60, unlock again, 2:Y555=$40 | Yes |
| Protect sector 0 | 2:Y555=$60, unlock again, 2:Y555=$20 | Yes |
| Exit any command above | write $F0 to any address (no unlock) | No |
Pan Docs shows the final address of the erase-sector command as ?:???? (it is the sector address, see below). Its asterisks mark the hidden-region,
protect and unprotect commands as needing flash write enable; the “sector 0 only” entries are from its text on sector 0 protection.
Status. After an erase, program or (un)protect command the flash returns status bytes instead of data. Bit 7 ($80) set means the
operation has finished; then leave the mode with $F0. Bit 4 ($10) set means a timeout. Bit 1 ($02) is set when the sector 0
protection was switched on by the Protect Sector 0 command.
Programming. Erase the sector first; an unerased sector may only accept bits being cleared (the stored bytes are ANDed with the new ones) or may not
work at all, and only an erase sets bits back to 1. Then enter program mode, write 128 aligned bytes, write any value other than $F0 to the last address
again to commit, wait until the status shows completion, and leave with $F0. Check what was written and repeat the 128-byte block without erasing if bits did
not clear. The hidden region is programmed the same way with its own commands, in two 128-byte blocks. After the last block of a sector, clear the flash write enable bit.
Erasing a sector. The last byte ($30) goes to an address inside the sector to erase. Each sector is 16 of the 8 KiB banks, so
sector n starts at flash bank n × 16. To erase sector 2 write 32 to $2000 to select flash bank 32 in window A,
then $30 to $4000 (any address $4000–$5FFF; the low address bits do not matter).
Protection. Flash write enable (register $1000) is wired to the chip’s write-protect pin and is 0 after power-up. While it is 0, sector 0
and the hidden region cannot be erased or programmed; sectors 1–7 always can while the flash is enabled. Erase chip never touches the hidden region, and if sector 0 is
protected (by the register, by the Protect Sector 0 command, or both) it erases sectors 1–7 only. The sector 0 protection set by the command is stored non-volatilely and is a
second layer: to be sure sector 0 can be changed, set flash write enable to 1 and then issue Unprotect Sector 0. Protect Sector 0 covers sector 0 only, whereas the register
covers sector 0 and the hidden region.
Source: Pan Docs MBC6 (itself from a GBDev forum thread by endrift, and relying on the Nintendo Power GB Memory cartridge documentation for the chip,
“which uses a nearly identical flash chip”). Everything in this subsection is Pan Docs’ text restated; the byte-level layout of the first unlock write
(2:5555 and 1:4AAA) is Pan Docs’ and we did not test it on hardware.
The two windows in emulators, and in the explorer
Compared with the raw source of the emulators that were read (samples/gb/sources): mGBA (src/gb/mbc/mbc.c, _GBMBC6) decodes address bits 10–15 as the register number: $0000–$03FF RAM enable (only $00 and $0A accepted), $0400/$0800 RAM banks A/B, $0C00 flash enable and $1000 flash write enable (both only logged as “unimplemented”), $2000–$27FF and $3000–$37FF the 8 KiB bank numbers of windows A and B (the whole byte), $2800 and $3800 the ROM or flash select (it tests only bit 3, so any value with bit 3 set selects the flash), and starts with ROM banks 2 and 3 in windows A and B. The flash it maps is 1 MiB stored after the RAM in the save file; no flash command ($AA, $55 …) is implemented, so a write to the flash does nothing. A bank number past the chip is wrapped to the chip size. Gearboy (MBC6MemoryRule.cpp, GPL 3, read raw) models the same two windows, and also the flash command state machine; it was fetched, but its flash is not compared line by line with Pan Docs here. SameBoy and Gambatte have no MBC6 (SameBoy’s GB_cart_defs and GB_update_mbc_mappings, Gambatte’s cartridge.cpp mapper list). So the windows are confirmed by one other implementation (mGBA, written from the same Pan Docs/endrift source) and the flash commands only by Pan Docs.
The explorer models the two windows: a Bank mapping section (window A, window B, fixed bank, RAM windows, flash chip, start-up, emulators), a Flash commands table, 8 KiB banks in the bank list (each can be seen in either window) and a disassembly of the chosen 16 KiB bank as its two 8 KiB halves, one in window A at $4000 and one in window B at $6000. A file cannot say which two banks a game picks, so the view puts consecutive halves there; the flash contents are not in a ROM image. The function mbc6Window in banking.js turns registers (bank, select value, ROM size) into the chip and offset a window shows, and is tested.
MBC7
With a two-axis accelerometer and a 256-byte EEPROM. Source: raw Pan Docs MBC7.md (one source, itself from a GBDev forum thread by endrift).
| Write to | Register | Effect |
|---|---|---|
$0000–$1FFF | RAM enable 1 | $0A enables the RAM registers, $00 disables. The second enable below must also be set. |
$2000–$3FFF | ROM bank number | Selects the bank at $4000: banks $00–$7F, “same as for MBC5” (Pan Docs: whether bank 0 can really be mapped needs confirmation). |
$4000–$5FFF | RAM enable 2 | Writing $40 enables access to the RAM registers. Any other value appears to disable access, but Pan Docs says this is not fully tested. Both enables must be set. |
At $A000–$AFFF the address bits 4–7 pick a register: $Ax0x write $55 erases the accelerometer
latch; $Ax1x write $AA latches it; $Ax2x/$Ax3x read the X value (low, high),
$Ax4x/$Ax5x the Y value (before the first latch both read $8000); $Ax8x is the EEPROM
(bit 0 DO, bit 1 DI, bit 6 CLK, bit 7 CS).
Accelerometer
The sensor is an ADXL202E with two axes. $A000–$AFFF holds registers, not memory: the register is chosen by address bits 4–7 and bits 0–3 and
8–11 are ignored. With either enable not set, reads give $FF and writes do nothing. The data must be latched before it is read: write $55 to
Ax0x to erase the latched data (it goes back to $8000), then $AA to Ax1x to latch a new sample. A new latch without the
erase in between changes nothing. Reads of both latch registers return $FF. Other writes to Ax0x and Ax1x do not appear to do anything (Pan Docs marks this partly unconfirmed). Each value is 16 bits, centred on $81D0; gravity moves it by about
$70, and the maximum range is unknown. Lower X values are towards the right, higher towards the left; lower Y values are towards the bottom, higher towards the top.
Do not put the CPU into HALT for at least 1.2 ms after latching, because HALT stops the cartridge clock the sensor needs and the samples get noisy (the same in double speed).
| Address | Access | Meaning |
|---|---|---|
Ax0x | write | $55 erases the latched sample |
Ax1x | write | $AA latches the accelerometer |
Ax2x, Ax3x | read | X value, low byte, high byte; $8000 before the first latch |
Ax4x, Ax5x | read | Y value, low byte, high byte; $8000 before the first latch |
Ax6x, Ax7x | read | always $00 and $FF; possibly a Z axis the sensor does not have |
Ax8x | read/write | EEPROM pins (below) |
Ax9x–AxFx | read | unused, $FF |
$B000–$BFFF | read | unknown; seems to read $FF |
EEPROM
The EEPROM is a 256-byte 93LC56 organised as 16-bit words. The register Ax8x is the chip’s four pins: bit 0 data out (DO), bit 1 data in (DI), bit 6 clock
(CLK, SK in game code), bit 7 chip select (CS). The chip’s ORG pin (8-bit or 16-bit addressing) does not appear to be wired to the register. A command is shifted in
one bit at a time into DI while the game toggles CLK by hand, so one EEPROM access takes many writes. Every command is preceded by a 1 bit; existing games put a 0 bit
before that (not required). The sequence games use to begin is:
- write
$00(CS low) - write
$80(CS high) - write
$C0(shift in a 0 bit: clock high) - write
$82(Pan Docs says “lower CS, raise DI”; by the bit layout above the value has CS high, CLK low and DI high, so that is our reading) - write
$C2(shift in a 1 bit) - then the command’s bits, each written with the clock low and again with the clock high.
Each command is 10 bits long (not counting data), most significant bit first. x means the bit is ignored and A is an address bit. Data are
16-bit words, so address 1 is bytes 2–3 of the EEPROM.
| Command | 10 bits | Data |
|---|---|---|
| READ | 10xAAAAAAA | then shift out 16 bits |
| EWEN (erase/write enable) | 0011xxxxxx | |
| EWDS (erase/write disable) | 0000xxxxxx | |
| WRITE | 01xAAAAAAA | then shift in 16 bits |
ERASE (set the address to $FFFF) | 11xAAAAAAA | |
ERAL (set the whole EEPROM to $FFFF) | 0010xxxxxx | |
| WRAL (set the whole EEPROM to a value) | 0001xxxxxx | then shift in 16 bits |
WRITE, ERASE, WRAL and ERAL must be preceded by EWEN. Programming takes time: keep clocking and watch DO, which the datasheet calls RDY, reads 1 when the command has finished.
(The command table, the 10-bit frames and the polling are Pan Docs’ text and the 93LC56 datasheet it cites; the Pan Docs entry for the MBC7 bank at $4000 says only “same as for MBC5,
bank 0 mapping needs confirmation”, so that is unconfirmed here too.)
Bank 0 and the registers in emulators
Raw source files of two emulators (samples/gb/sources): SameBoy (Core/memory.c, GB_MBC7 case; mbc.c) stores the written byte unchanged as the ROM bank, makes no “0 becomes 1” correction (its MBC1, MBC2 and MBC3 cases have one, its MBC5 and MBC7 cases do not), so bank 0 can be mapped at $4000 (SameBoy’s reset code sets the start bank to 1 for every other controller but has no such line in its MBC7 branch). mGBA (_GBMBC7) masks the byte with $7F and calls the common bank switch, which has no 0 correction either, so bank 0 is mapped at $4000 too; in mGBA a write of $0A to $0000–$1FFF sets the first enable and any other value clears all access, and a write of exactly $40 to $4000–$5FFF sets the second enable while any other value clears it; SameBoy tests == $0A and == $40 the same way. Both therefore agree with Pan Docs’ “same as MBC5” (bank 0 works) and with the page’s statement that other values for the second enable disable access. The real chip has not been tested for this by any source found, so the remaining uncertainty is the hardware’s, not the emulators’. The accelerometer centre and gain are modelled by SameBoy as $81D0 + $70 × (acceleration in g), (0x81D0 + 0x70 * accelerometer_x in its latch code), which matches Pan Docs’ centre $81D0 and step of about $70; no source found gives the maximum range of the real sensor, so that stays unknown. The $B000 region: SameBoy’s MBC7 RAM read and write routines ignore addresses from $B000 (read returns $FF, write is dropped), the same as Pan Docs’ “seems to read $FF”.
MMM01
For multi-game cartridges. It starts in an unmapped mode in which the last 32 KiB of the ROM (the menu) appear at
$0000–$7FFF; the menu sets the extended bits to choose a game, then sets mapping enable, which makes the chip
behave like an MBC1 for that game. The explorer reads the header from where the console does (in the last 32 KiB) and shows the menu’s start-up mapping, see below.
| Write to | Register | Effect |
|---|---|---|
$0000–$1FFF | RAM enable, RAM bank mask, mapping enable | Bits 0–3 $A enable RAM; bits 4–5 mask the RAM bank bits; bit 6 turns on MBC1 behaviour and locks the extended bits. |
$2000–$3FFF | ROM bank number | Bits 0–4 as MBC1 (maskable); bits 5–6 the middle bits, usable only before mapping. |
$4000–$5FFF | RAM bank number | Bits 0–1 the RAM bank; bits 2–3 RAM bank high and bits 4–5 ROM bank high (only before mapping); bit 6 locks the mode select. |
$6000–$7FFF | Banking mode select | Bit 0 the MBC1 mode; bits 1–5 the ROM bank mask; bit 6 multiplex. |
Details from Pan Docs. The registers are 7 bits wide and $00 at power-up (the ROM bank number acts as $01). In unmapped mode the real header must be at
offset (size − 32 KiB) + $100 of the file, not $100 (which is the first game’s header). Bits marked “only before mapping” can be changed only in unmapped mode.
The two mask fields act as write locks on the matching bits of the low bank registers, even in unmapped mode, so the menu can use the locked bits for game selection and thereby
set the size of the game:
ROM bank mask (bits 1–5 at $6000) | Game ROM | RAM bank mask (bits 4–5 at $0000) | Game RAM |
|---|---|---|---|
00000 | 512 KiB | 00 | 32 KiB |
10000 | 256 KiB | 10 | 16 KiB |
11000 | 128 KiB | 11 | 8 KiB |
11100 | 64 KiB | ||
11110 | 32 KiB |
The lowest mask bit is ignored (always 0), so the lowest bit of the ROM bank is always writable. If the unmasked bits of the low ROM bank are all 0, bank $01 of the game is used
instead; this is checked live when the mask changes. Multiplex (bit 6 at $6000, never used commercially) swaps the roles of the RAM bank low bits and the ROM bank mid bits, allowing game
ROMs of 1 MiB or 2 MiB with a fixed 8 KiB of RAM, with the same bank 0/$20/$40/$60 limits as an MBC1; the RAM bank mask then limits ROM size
(00 2 MiB, 10 1 MiB). Bit 6 at $4000 locks the MBC1 mode bit. Pan Docs marks several points unverified: whether RAM works in unmapped mode, whether writing the mapping
enable together with a new RAM mask honours that mask, and whether bit 0 of the ROM bank still affects the $4000 window in unmapped mode.
Limits, rules and diagrams
Source: raw Pan Docs MMM01.md only (itself from the tauwasser wiki); not checked against hardware or a second implementation here.
- Maximums. Per game, the same as an MBC1: 512 KiB of ROM with banked 8, 16 or 32 KiB of RAM (default configuration), or 2 MiB of ROM with an unbanked 8 KiB of RAM (“multiplex” mode, never used commercially). Whatever the games, the whole cartridge supports up to 8 MiB of ROM and 128 KiB of RAM: up to 255 games of 32 KiB plus a 32 KiB menu, but RAM only as 16 banks of 8 KiB. No MMM01 cartridge shipped with more than 4 games, and only one has any RAM.
- Game select. The ROM and RAM game-select bits need not be equal, so a cartridge need not waste RAM on games without it, and games of different sizes can be packed tightly. Pack the largest games first: the last 32 KiB are the menu (the Taito Variety Pack, for example, has three 128 KiB games and one 64 KiB game in 512 KiB, leaving 32 KiB unused plus the 32 KiB menu).
- Warning. The MMM01 cannot completely block RAM access for a game. If the cartridge has RAM, assign all no-RAM games to the same single RAM bank so they cannot touch another game’s save.
- Power-off. RAM enable (bits 0–3 of the
$0000register) is disabled automatically when the console is powered off or the cartridge removed. All registers are 7 bits wide and$00at power-up, the ROM bank number acting as$01. - Mapping enable (bit 6 at
$0000, changeable only while unmapped) starts MBC1 emulation at once, mapping the selected game banks (normally$00and$01of the game), and locks all extended bits. In mapped mode the extra bits cannot be written and the chip behaves as an MBC1. Pan Docs does not know whether the RAM bank mask written in the same write is honoured; the one released cartridge with RAM writes the mask twice (the same value) before enabling mapping. - Mapped-mode ROM bank rule at
$4000. The game cannot reach its banks$00,$20,$40,$60there; the low bit is forced to 1 ($01,$21,$41,$61). In terms of registers: ifROM Bank Low & ~ROM Bank Maskis$00thenROM Bank Low | 1is used. Example: ROM Bank Low$10with mask$30gives$10 & ~$30 = $00, so bank$11is mapped instead of$10. The check is live: it is redone when the mask changes, and the register value itself never changes. - Mode select (
$6000bit 0). With multiplex off: 0 = RAM banking disabled (default), the A000–BFFF region is locked to game RAM bank 0 and the unmasked bits of RAM Bank Low count as 0; 1 = RAM banking enabled, the full RAM Bank Low register is used. With multiplex on: 0 = simple ROM banking (default):$0000–$3FFFis locked to game ROM bank 0 and the unmasked bits of RAM Bank Low count as 0 for that region; 1 = advanced: RAM Bank Low switches that region, giving access to game banks$20,$40,$60. - Multiplex (bit 6 at
$6000, changeable only while unmapped) swaps RAM Bank Low and ROM Bank Mid, as in the large-ROM wiring of an MBC1, allowing larger game ROMs at the cost of only 8 KiB of RAM; in mapped mode RAM Bank Low stays writable, so the game controls up to two extra ROM bank bits (if unmasked). The RAM Bank Mask still applies to RAM Bank Low and so now limits the ROM size: mask00gives 2 MiB,10gives 1 MiB,11gives 512 KiB (Pan Docs: pointless, since multiplex exists to support 1 MiB and larger games). The ROM Bank Mask should then be00000, to avoid masking bits in the middle of the ROM bank number. - Register write order. Because some registers write-protect others, the best order is: (1) ROM bank register
$2000; (2) mode register$6000(ROM bank mask and mode); (3) RAM register$4000(mode write disable and RAM bank); (4) RAM enable$0000(RAM bank mask and mapping enable). Most released cartridges follow this order.
Addressing diagrams (address bits of the ROM or RAM chip, high to low; “Game Boy” means the address bits from the CPU). Low = the five bits at $2000; Mid = bits 5–6 at $2000; High = ROM Bank High (bits 4–5 at $4000); RLow = RAM Bank Low (bits 0–1 at $4000); RHigh = bits 2–3 at $4000.
| Area and state | ROM or RAM address bits |
|---|---|
ROM $0000–$3FFF, unmapped | bits 22–15: always 1; bit 14: always 0; bits 13–0: Game Boy. A smaller cartridge uses only the needed bits (512 KiB uses 19). This is how the last 32 KiB of the ROM (the menu) appears at $0000–$7FFF. |
ROM $4000–$7FFF, unmapped | bits 22–15: 1; bit 14: “always 1?” (Pan Docs marks this to be verified: the lowest bit of ROM Bank Low after the 0 → 1 remap may still affect it, which would matter briefly while game-select bits are being set before they are masked); bits 13–0: Game Boy |
ROM $0000–$3FFF, mapped, multiplex off | bits 22–21: High; bits 20–19: Mid; bits 18–14: Low AND Mask; bits 13–0: Game Boy |
ROM $4000–$7FFF, mapped, multiplex off | bits 22–21: High; bits 20–19: Mid; bits 18–14: Low (whole value, not masked; masked-zero bank 0 remapped to 1); bits 13–0: Game Boy |
ROM $0000–$3FFF, mapped, multiplex on, mode 0 | bits 22–21: High; bits 20–19: RLow AND RAM Bank Mask; bits 18–14: Low AND Mask; bits 13–0: Game Boy |
ROM $0000–$3FFF, mapped, multiplex on, mode 1 | bits 22–21: High; bits 20–19: RLow (whole value); bits 18–14: Low AND Mask; bits 13–0: Game Boy |
ROM $4000–$7FFF, mapped, multiplex on, either mode | bits 22–21: High; bits 20–19: RLow (whole value); bits 18–14: Low (whole value); bits 13–0: Game Boy |
RAM $A000–$BFFF, mode 0, multiplex off | bits 16–15: RHigh; bits 14–13: RLow AND RAM Bank Mask; bits 12–0: Game Boy |
RAM $A000–$BFFF, mode 1, multiplex off | bits 16–15: RHigh; bits 14–13: RLow (whole value); bits 12–0: Game Boy |
RAM $A000–$BFFF, multiplex on (either mode) | bits 16–15: RHigh; bits 14–13: Mid (ROM Bank Mid); bits 12–0: Game Boy |
Pan Docs also says it is unknown whether RAM can be used in unmapped mode.
Header location, the menu and three emulators
Raw source files read for this section are in samples/gb/sources: Gambatte (the pokemon-speedrunning fork, GPL 2: mmm01.cpp), SameBoy (MIT: Core/mbc.c and memory.c) and mGBA (MPL 2: licensed.c, main.c). None is hardware documentation.
| Point | Pan Docs | Gambatte | SameBoy | mGBA |
|---|---|---|---|---|
| Where the header is | (size − 32 KiB) + $100; the first game’s header is at $0100 | no file rotation: unmapped it selects banks $1FE and $1FF masked to the ROM size, the last two 16 KiB banks | a dump whose $0147 (first header) says MMM01 has its first 32 KiB moved to the end; a dump already in cartridge order is recognised when the last-32-KiB header has the same 48 logo bytes and an MMM01 type; the same logo with MBC3 type $11 there is “assumed MMM01” with a warning; the RAM size is read from the header in the last 32 KiB | type $0B–$0D from the header at $0100; unmapped: banks size/16 KiB − 2 and − 1 |
| Mapping enable | bit 6 of the $0000 register, only in unmapped mode | bit 6 of that register | the same write sets “locked” | any write to $0000–$1FFF while unlocked locks (the value is ignored); the bank set by the $2000 and $4000 writes (7 bits plus bits 4–5 shifted to bits 7–8) becomes bank 0 |
| ROM bank mask, multiplex | mask bits 1–5 and multiplex bit 6 of $6000, unmapped only | rombankMask() = register 3 >> 1 & $1E; isMuxed() | rom_bank_mask, multiplex_mode | not modelled; after locking the value written to $2000 is added to bank 0 without a mask |
| Bank 0 → 1 correction | on the unmasked bits, live | max(unmasked, 1) | increments when bank at $4000 equals bank at $0000 | none |
| RAM in unmapped mode | unknown | RAM enable and RAM bank written in either mode | RAM enable set in either mode; RAM bank applied once locked | RAM writes ignored until locked |
Where they differ no statement is made about the hardware; the differences are the “unknown” points of Pan Docs (unmapped RAM, honouring a RAM mask written together with the mapping bit) seen from three implementations. The explorer follows Pan Docs for the layout and states each emulator’s reading in a table of the same shape: it recognises a file as an MMM01 cartridge when the last 32 KiB hold a header with the Nintendo logo and a type $0B–$0D (a variant of SameBoy’s rule: SameBoy needs the same 48 logo bytes as the first header, the explorer needs a header whose logo is the Nintendo logo the boot ROM checks, first half at least), shows that menu header as a child of the bank that holds it in the tree, checks the ROM size code of the menu header against the file, lists the last two banks as the unmapped start-up mapping at $0000–$7FFF, and disassembles them as such. The header at $0100 stays the first game’s and is shown as before.
Wisdom Tree, EMS and Bung
Source: raw Pan Docs othermbc.md (“Other MBCs”), one source. These are not in the cartridge-type table of the header; they are recognised by the header values listed in the last subsection. The explorer does not model them (it shows the controller named by the type code).
Wisdom Tree
A simple, cost-optimised one-chip design: a 74LS377 octal latch beside the ROM chip. Two unusual properties follow from it:
- It switches the whole 32 KiB ROM area (
$0000–$7FFF), not just$4000–$7FFF. So the interrupt vectors must be duplicated in every bank. The latch’s contents at power-on cannot be guaranteed, so the ROM header and some code that switches to a known bank must be in every bank as well. The mapper could therefore serve as a multicart mapper for 32 KiB ROMs if each bank has room for small start-up code and the games never write to$0000–$7FFF. Pan Docs’ patch example, for five spare bytes at the end of each bank: at$0100in all banks but the first,nop; jp $7FFB; at$7FFBin all banks,ld hl,$0100; ld [hl],a; jp hl. - The bank is chosen by address lines A7–A0, not by the data. The 74LS377 latches on the positive edge of the write pulse, by which time the value on the data bus is no longer valid, so the designer used the low address bits instead. The written value is ignored and the low 8 bits of the address are the bank number: to select bank
$XX, write any value to$YYXXwhere$YYis$00–$7F.
EMS
Pan Docs marks this as unverified on authentic EMS hardware (“take with a grain of salt”; a GitHub issue, #423, is open for contributions). A header matching any of these is detected as EMS: the header name “EMSMENU” (NUL-padded); the name “GB16M” (NUL-padded); or cartridge type ($0147) $1B with region ($014A) $E1. Registers:
| Write | Effect |
|---|---|
$2000 | Normal MBC behaviour, plus the written value is saved in the “$2000 latch” |
$1000 | $A5 turns configure mode on, $98 turns it off; other values have no known effect |
$7000 while configure mode is on | Copies the $2000 latch to the OR mask |
Once the OR mask is set, all ROM reads OR address lines A21–A14 (the bank number) with the mask, which chooses the game the CPU sees; if the mask is not aligned to the game size the result may be nonsensical. The mapper does not support an outer bank for battery SRAM.
To start a game, with code running from RAM: (1) write $A5 to $1000; (2) write the game’s first bank number to $2000; (3) write any value to $7000; (4) write $98 to $1000; (5) write $01 to $2000 (so 32 KiB games work); (6) jump to $0100.
The EMS FAQ (a second source). “EMS FAQ” (research by nitro2k01, Didrik Madheden, version 1.1 of 2013-09-21, on blog.gg8.se; read on 2026-11-19 through the fetch tool, which returns a summary: our words, the text is not stored here because its licence is not stated) describes the EMS flash cartridges by revision. Its points, as summarised: the 64M (64 Mibit, 8 MiB) cartridge is two “pages”, each behaving like one 32M revision-2 cartridge; the page is chosen by switching the console off and on, and the author found no write to $0000–$7FFF that changes it. Revision 2 (and the 64M): write the target bank to $2000, then any value to $7000, which copies that bank value into the internal “multi ROM” register; no configure mode is needed; the register is ORed with the bank number of every ROM access, including bank 0 reads; its lowest bit is ignored; it always behaves like an MBC5 (writing $00 to $2000 does not give bank 1), and it ignores other writes, so the $1000 $A5/$98 sequence and the size and RAM option flags belong to revision 1 only; images must be aligned to their own size; the multi-ROM register is unprotected, so a running game that writes $7000 can crash. The standard menu’s double write of $0A to $0000 (“disable SRAM protection”) is called unnecessary and potentially harmful on 32M and 64M. A gbdev forum post (not read in full) says the emulation of the EMS64 mapper is imperfect and that parts of it act like an MBC1 (bank-0 correction and banking modes). Compared with Pan Docs: Pan Docs’ description (the $1000 configure mode, the $2000 latch copied by a $7000 write, the OR mask on every read) matches the revision-1 style procedure; the FAQ says a revision-2 or 64M cartridge needs only the two writes. Gearboy (FlashcartMemoryRule.cpp, GPL 3, read raw) implements the Pan Docs procedure, with $A5/$98 at $0000–$1FFF (not only $1000), the bank low byte at $2000–$2FFF and bit 8 at $3000–$3FFF, the latch copied to the OR mask by a write to $7000 in configure mode, bank at $0000 = mask and bank at $4000 = (bank | mask), and RAM bank $4000 (4 bits). So the EMS description is no longer “one unverified source”: Pan Docs, one detailed FAQ from measurements on the cartridges, and one emulator agree on the OR mask and the bank register; they disagree only on whether configure mode is needed, which the FAQ ties to the revision (a point the explorer’s “start a game” row states as Pan Docs’ procedure).
Bung
Pan Docs says only that “Bung and EMS MBCs are reported to exist”, and that its proposed detection value is cartridge type $BE. No register or behaviour description of the Bung mapper exists in Pan Docs, and none was found elsewhere. Searches for a hardware description (the Bung Game Boy carts such as the Doctor GB family, the gbdev wiki, tauwasser’s wiki, a general web search for the mapper’s registers) found none. The one implementation found is Gearboy: it treats “Bung/EMS” as one mapper (CartridgeBungEMS in Cartridge.cpp, detection by the title “EMSMENU” or “GB16M”, or type $BE, or type $1B with $014A = $E1; the cartridge database can also force it), and uses the single FlashcartMemoryRule described under EMS above. That is a statement about Gearboy, not about the Bung hardware: no source says that a Bung cartridge switches banks like an EMS one, so the explorer still shows no bank model for $BE and says why. What would settle it: a Bung cartridge’s own documentation or a dump with the mapper’s start-up code, neither found.
Detection values (a proposal, not a standard)
Pan Docs proposes these magic values so that emulators can detect multicart mappers (for developing a menu for real multicart hardware); “actual adoption may vary”.
| Mapper | Detected when |
|---|---|
| Wisdom Tree | ROM title “WISDOM TREE” (the space may be a NUL), $0147 = $00, $0148 = $00 and the file is over 32 KiB (this works for Wisdom Tree Inc.’s own games); or $0147 = $C0 and $014A = $D1 |
| EMS | $0147 = $1B and $014A = $E1 |
| Bung | $0147 = $BE |
MBC1M is also a multicart board; it is under MBC1, and MMM01 has its own section.
M161
Source: raw Pan Docs M161.md (itself from the tauwasser schematic “DMG-M161-M01”; this chapter had not been read by earlier rounds of this page). Mani’s (Nintendo’s official Chinese distributor) simple multi-cart mapper, used by one cartridge only: Mani’s 4 in 1 (Tetris, Tennis, Alleyway and Yakuman); all later Mani 4 in 1 cartridges use the MMM01, so the M161 is its predecessor. It allows eight 32 KiB banks (one menu and at most seven games), one bank switch per power-up, and no SRAM, so only games with no mapper of their own can be on it. It is a 74HC161A used as a latch: the low 3 bits of the data are latched into the ROM address lines A15–A17 by the first write to $0000–$7FFF (address bit 15 = 0); the fourth output, tied to a constant high input, then holds the latch closed. The one 3-bit register ($00–$07, higher bits discarded) switches the whole 32 KiB at $0000–$7FFF; at start-up bank 0 is there; once any write has happened, even of 0, further writes are ignored until power-off. Pan Docs advises placing the switching code just before $0100 so execution falls through to the game’s start.
Emulators agree: Gambatte (m161.cpp: rombank_ = (data & 7) << 1 once, then mapped_), mGBA (_GBM161: bank = value & 7, switches banks 2n and 2n + 1, then locked). Pan Docs gives no header value to detect it: Gambatte uses a file rule (size 256 KiB, $0147 = $10 and the title “TETRIS SET”); Gearboy relies on a game database entry (GB_DB_M161_MAPPER in Cartridge.cpp), and mGBA has the mapper type (its GBX container table names it) but how it picks it for a plain ROM was not read. The explorer uses Gambatte’s rule, says so, and shows the 32 KiB banks.
How emulators detect the multicart mappers
Compared from the raw source files (samples/gb/sources); each emulator’s rule is what it does, not a standard.
| Mapper | Pan Docs | Gambatte (cartridge.cpp) | SameBoy (mbc.c) | Explorer |
|---|---|---|---|---|
| MBC1M | a Nintendo copyright header in bank $10 | 32 or more banks, header checksum correct in bank 0 and in bank $10, same logo bytes | MBC1 type, file at least $44000 bytes, the same 48 logo bytes at $0104 and $40104 | MBC1 type ($01–$03), file of 512 KiB or more, Nintendo logo in bank $10 (the earlier “exactly 1 MiB” bound was replaced by the emulators’ bound) |
| MMM01 | header at (size − 32 KiB) + $100 | header checksum OK at start, a power-of-two number of banks (at least 2), checksum and logo equal in the second-to-last bank, type $0B–$0D; also first type $01 with $11 in the menu (“hack for bootleg MMM01 games”) | type $0B–$0D at $0147 (then rotates the file), or the same logo in the last 32 KiB with such a type (or $11) | last 32 KiB hold a header with the Nintendo logo (first half at least) and type $0B–$0D |
| M161 | none | 256 KiB, $0147 = $10, title “TETRIS SET” | not supported | Gambatte’s rule |
| Wisdom Tree | title “WISDOM TREE”, types $00/$00; or $C0 and $D1 | $C0 and $D1, or a header-checksum rule over bank 2 | not supported | Pan Docs’ rule |
| EMS | EMSMENU, GB16M, or $1B and $E1 | reports “unsupported EMS multicart” for $1B and $E1 | not supported | Pan Docs’ rule |
| Bung | $0147 = $BE | not supported | not supported | Pan Docs’ rule (Gearboy treats it as the EMS mapper) |
Real multicart dumps were tried against these rules; see the sample README (samples/gb/README.md) for which files were found and what the explorer said about each.
HuC1 and HuC3
Hudson Soft’s controllers add an infrared port; the HuC3 adds a real-time clock and a speaker. HuC3 is described by Pan Docs (HuC3.md) as a successor to the HuC1. Pan Docs (HuC1.md) also notes that, despite many sources on the internet claiming HuC1 is “similar to MBC1”, it actually differs from MBC1 significantly: see the table, where its $0000 register selects RAM or infrared mode instead of enabling RAM.
Memory map of the HuC3 (HuC3.md): $0000–$3FFF is ROM bank 00 (read-only); $4000–$7FFF is ROM bank $00–$7F, any of the further 16 KiB banks, and “like the MBC5, bank $00 can also be mapped to this region”; $A000–$BFFF is RAM bank $00–$03 or an RTC/IR register (read/write), depending on the register selection and the RAM bank number. The HuC1 memory map (HuC1.md) has the same four write-only registers as in the table and $A000–$BFFF as cart RAM or the IR register; its $6000–$7FFF row is marked “Nothing?” in Pan Docs, and writes there seem to have no effect and may safely be ignored (some games write there as if it were an MBC1).
| Write to | HuC1 | HuC3 |
|---|---|---|
$0000–$1FFF | $0E selects infrared mode, anything else RAM mode. | Low 4 bits: $0 RAM read-only, $A RAM read/write, $B RTC command write, $C RTC response read, $D RTC semaphore, $E infrared. |
$2000–$3FFF | ROM bank, at least 6 bits. | ROM bank, 7 bits. |
$4000–$5FFF | RAM bank, at least 2 bits. | RAM bank, at least 2 bits. |
$6000–$7FFF | No effect. | Unused (games write $01 with no visible effect). |
HuC1 at $A000–$BFFF in infrared mode: write $01 to turn the transmitter on, $00 off;
a read gives $C1 if light was seen, $C0 if not. In RAM mode the region is ordinary cart RAM. Some games still write $0A and $00 to
$0000 as if it enabled RAM; HuC1 has no RAM disable.
HuC3 real-time clock and infrared
The HuC3 also provides a real-time clock, a speaker (tone generator) and infrared. Pan Docs says it is poorly understood: observed behaviour suggests that the clock and tone generator are
run by a 4-bit microcontroller with its own program ROM, and the CR2025 coin cell is user-replaceable. The RAM bank register accepts at least 2 bits.
Address lines A12–A0 are not connected to the chip, so the offset inside $A000–$BFFF is ignored, and data line D7 is not connected: bit 7 of a read is open bus
(usually 1) and bit 7 of a write is ignored. If a value other than those in the table is written to $0000, reads from $A000–$BFFF give open-bus values
(often $FF) and writes are ignored. Registers selected with $0000:
| Register | Access | Meaning |
|---|---|---|
| $B, command/argument | write | Bits 6–4 the command, bits 3–0 the argument ($62 is command 6, argument 2). Writing only fills the “mailbox”; it does not run the command. |
| $C, command/response | read | Bits 6–4 the last command written to $B, bits 3–0 the result of the last command executed. |
| $D, semaphore | read/write | Read: bit 0 high when the clock microcontroller is ready for a command, low when busy. Write with bit 0 clear: execute the command last written to $B. |
| $E, infrared | read/write | Like the HuC1’s; bit 0 carries the infrared signal. |
The clock chip gives access to a window of 256 nybbles (4-bit values) of the microcontroller’s memory. Multi-nybble values are little-endian (least significant nybble at the lowest address). The sequence games use for one command:
- write
$0Dto$0000(select the semaphore); - poll
$A000until bit 0 is set; - write
$0Bto$0000(select command/argument); - write the command and argument to
$A000; - write
$0Dto$0000; - write
$FEto$A000(clear the semaphore: execute); - poll
$A000until bit 0 is set (done); - write
$0Cto$0000(select command/response); - read
$A000and use the low 4 bits (steps 8 and 9 only for commands that return a result).
| Command | Effect |
|---|---|
$1 | Read the value at the access address and increment the address |
$3 | Write a value at the access address and increment the address |
$4 | Set the access address, least significant nybble |
$5 | Set the access address, most significant nybble |
$6 | Run the extended command named by the argument |
Pocket Family GB2 uses command $2 with argument $0 for an unknown purpose; commands $0 and $7 have not been seen. Extended commands
(command 6, argument shown):
| Argument | Effect |
|---|---|
$0 | Copy the current time to locations $00–$06 |
$1 | Copy locations $00–$06 to the current time and update the event time (so the time left until the event is kept) |
$2 | Seems to be a status request, used at start-up; games do not start unless the result is $1 |
$E | Executing it twice triggers the tone generator |
Commands $0 and $1 read and write the current time atomically. RTC locations (purposes inferred by Pan Docs from observed behaviour):
| Location | Purpose |
|---|---|
$00–$06 | Input or output space for reading or writing the current time |
$10–$12 | Minute-of-day counter (rolls over at 1440) |
$13–$15 | Day counter |
$26 | Tone selection, in the two least significant bits |
$27 | Tone generator enabled if the value is 1 (all bits checked) |
$58–$5A | Event time, minutes |
$5B–$5D | Event time, days |
The meaning of the individual nybbles of $00–$06 (which holds minutes, days and so on) is not given by Pan Docs; the emulators below give a layout.
HuC1 and HuC3 in three emulators
Raw files in samples/gb/sources: SameBoy Core/memory.c (GB_HUC1 and GB_HUC3 cases and huc3_write), mGBA src/gb/mbc/huc-3.c, licensed.c (_GBHuC1) and memory.h (register names), Gambatte huc1.cpp, huc3.cpp, huc3_chip.cpp; Gearboy has both too (not compared line by line). None is hardware documentation; all were written from observed behaviour.
| Point | Pan Docs | SameBoy | mGBA | Gambatte |
|---|---|---|---|---|
HuC1 $0000 register | $0E infrared, otherwise RAM; no RAM disable | ir_mode = (value & $F) == $E | $0E turns RAM off (infrared), any other value turns it on | same split (huc1.cpp) |
| HuC1 ROM bank | at least 6 bits | the byte is stored; masked by the ROM size | value & $3F (6 bits) | the byte, masked by the ROM size |
| HuC3 mode register | low 4 bits: 0, A, B, C, D, E | the byte is stored as the mode; RAM enabled only for $A | the value is stored as the mode; RAM only for $A | ramflag_ = data & $F |
| HuC3 ROM bank | 7 bits; bank 0 can be mapped | the byte is stored (no correction) | value & $7F, no correction | the byte, no correction |
| HuC3 command 6, argument 2 | a status request at start-up; games do not start unless the result is 1 | the argument is kept in access_flags; with 2 a response read returns 1 | named “read-only mode” (GBHUC3_CMD_RO), logged as not implemented; every command ends with the response byte $E1 (low nibble 1) | (chip model in huc3_chip.cpp, not compared) |
HuC3 RTC locations $00–$06 | input or output of the time; layout not given | $00–$02 minutes of the day (3 nybbles, least significant first), $03–$06 days (4 nybbles) | six nybbles are copied by command 6/0 from $10–$15: minutes (3 nybbles) then days (3 nybbles, a 12-bit day count); command 6/1 copies them back | — |
| HuC3 locations used | $10–$15 time, $26/$27 tone, $58–$5D event | event minutes $58–$5A, event days $5B–$5E (4 nybbles), $5F event enable (bit 0) | adds $16 “RTC enable”, $5E alarm tone, $5F alarm enable | — |
Commands $0 and $7 | not seen | not implemented (it handles 1 read, 3 write, 4 and 5 set the address and 6 store the argument; it also treats command $2, which Pan Docs says Pocket Family GB2 uses with argument 0 for an unknown purpose, as a write that does not advance the address) | not implemented (the commit routine logs an unknown mode for them) | — |
Reading the table: both emulators agree with Pan Docs on the mailbox commands and the location of minutes ($10–$12) and days ($13–$15 in mGBA, with SameBoy keeping a fourth day nybble); they disagree on whether location $06 exists, and on whether a day count has 12 or 16 bits. A real Pocket Family GB2 or a dump of the HuC3’s microcontroller would settle command $2, the commands $0 and $7 and the width; none was found, so those points stay unknown, now with the emulators’ readings stated.
Game Boy Camera
Works much like an MBC3.
| Write to | Register | Effect |
|---|---|---|
$0000–$1FFF | RAM enable | $0A enables writes, $00 disables. Disabled at reset. |
$2000–$3FFF | ROM bank number | $00–$3F; bank 1 at reset. |
$4000–$5FFF | RAM bank / camera register select | $00–$0F a RAM bank; a value with bit 4 set (usually $10) selects the camera registers, mirrored every $80 bytes. |
The ROM bank at $4000 can be any bank including 0 (bank 1 at reset); RAM bank 0 is selected at reset. RAM can be read only while the capture unit is not working (it
reads $00 otherwise), and written only while the cartridge’s PHI clock pin is 1, which most cartridge readers and writers cannot handle. Reading registers
or RAM is always enabled, and writing the registers is always enabled (the RAM enable matters for RAM writes). The cartridge has four chips: the controller (MAC-GBD), 1 MiB ROM, 128 KiB RAM
and, on a separate board, the M64282FP “artificial retina” image sensor, which the controller drives and which does the capture settings.
Gameboy_Camera.md lists the parts on the main board (inscriptions as printed there; the sensor is on a separate board and is not in the list):
| Component | Part / inscription | Description |
|---|---|---|
| U1 | MAC-GBD Nintendo 9807 SA | I/O, memory control |
| U2 | GBD-PCAX-0 F M538011-E - 08 8145507 | 1 MB ROM |
| U3 | 52CV1000SF85LL SHARP JAPAN 9805 5 0A | 128 KB RAM |
U1 is the only chip connected to the cartridge pins (besides some address pins of the ROM); U2 and U3 are connected to U1, and the sensor board is connected to U1. U1 turns the Game Boy CPU’s commands into the signals the M64282FP needs. Pan Docs remarks that the sensor datasheet is very poorly explained, and that the datasheets of similar sensors, the M64283FP and M64285FP, can help to understand some things about the one in the camera.
Camera registers $A000–$A035
With a camera register bank selected (bit 4 of the value written at $4000; games use $10) $A000–$BFFF holds registers, mirrored every
$80 bytes. All are write-only except $A000; the others read $00. All registers are $00 after reset.
| Address | Sensor register | What it does |
|---|---|---|
$A000 | trigger | Bits 0–2 can be read and written, other bits read 0. Writing a value with bit 0 set starts a capture; a write with bit 0 clear does not. Bits 1 and 2 supply the value written to sensor
registers 4, 5 and 6 used in 1-D filtering. Reading bit 0 gives 1 while the hardware is working and 0 when the capture is over. While capturing, all RAM banks read $00 and writes are ignored. Writing 0 to bit 0 stops the capture (RAM readable
again); writing 1 again continues it with the old parameters even if the registers changed meanwhile. |
$A001 | register 1 | Output gain and edge operation mode: bit 7 N (exclusively set vertical edge enhancement mode), bits 5–6 VH (vertical/horizontal edge enhancement mode), bits 0–4 G (analogue gain) |
$A002, $A003 | registers 2, 3 | Exposure time, a 16-bit value, $A002 the high byte and $A003 the low byte. One step is 16 PHI clocks, about 15.26 µs (the sensor datasheet says 16 µs); if N is 1 the value
should be at least $0030. Double the values in CGB double-speed mode, where PHI runs twice as fast. |
$A004 | register 7 | Output voltage reference, edge enhancement ratio, and image inversion |
$A005 | register 0 | Output reference voltage and enabling the zero-point calibration |
$A006–$A035 | (controller) | 48 bytes: a 4×4 matrix of 3 bytes per element, in rows (element x,y at $A006 + (y×4 + x)×3), for dithering and contrast |
Gain. The gain code G (bits 0–3, plus bit 4 for +6 dB) selects 14.0, 15.5, 17.0, 18.5, 20.0, 21.5, 23.0, 24.5, 26.0, 29.0, 32.0, 35.0, 38.0, 41.0, 45.5 and 51.5 dB for codes 0 to 15 (Pan Docs’ own table
prints the first row’s code as 0001 twice, an evident typo; we list the sequence in order). The camera software uses $00, $04, $08, $0A for 14, 20, 26 and 32 dB, which Pan Docs says translate to linear gains of 5.01, 10.00, 19.95 and 39.81. The bits of $A001, $A004 and $A005 that Pan Docs’ prose does not tabulate are taken from its sample emulator routine, in the next subsection.
Matrix. For each pixel at position (x, y) modulo 4, the three bytes of its element are thresholds r0 < r1 < r2 (an inference from the emulator code Pan Docs includes): a value below r0 becomes
colour 0, below r1 colour 1, below r2 colour 2, otherwise colour 3 (the sample code outputs $00, $40, $80, $C0 and stores them as 2-bit tile pixels, the darkest as 3). Pan Docs’ drawing of the matrix
repeats the labels “23, 33” in its third row, a typo.
Timing. A capture takes 32446 + N bit + 16 × exposure M-cycles, where the N term is 0 if bit 7 of $A001 is set and 512 otherwise. The sensor image is 128 × 128 but the top and bottom rows are corrupted, so
the controller uses the middle 112 rows (it skips the first and last 8). Pixels are written to RAM as they are read, so an interrupted capture leaves part of the new picture followed by the old one.
Sample exposure values from Pan Docs: $0030 direct sunlight, $0300 not in direct sunlight, $0800 a well lit room by day, $2C00 a dark room, $5000 a dark room with a reading lamp, $F000 a dark room with a TV on.
Register bits and edge processing
Pan Docs gives these in its sample code for emulators (code taken from GiiBiiAdvance), as real text; the sensor’s edge-processing pictures (horizontal, vertical and 2-D modes, the 1-D filter hardware, positive, negative and edge-extraction samples) are drawings in Pan Docs; their content is written out as text in The seven figures in words below.
The sample code indexes the registers by their cartridge address, CAM_REG[n] = $A000 + n (so its “register 0” is the trigger register $A000, whose bits 1–2 Pan Docs says supply the values written to sensor registers 4, 5 and 6 for 1-D filtering). These are not the M64282FP’s own register numbers, which the register table above gives ($A004 is sensor register 7, $A005 sensor register 0).
| Cartridge address | Bits | Name | Meaning (sample code) |
|---|---|---|---|
$A000 (the sample’s “register 0”) | 1–2 | P, M | The value (CAM[0] >> 1) & 3 picks P and M, used by 1-D filtering: 0: P = 0, M = 1; 1: P = 1, M = 0; 2 or 3: P = 1, M = 2. Bit 0 of P (value 1) adds the pixel itself, bit 1 (value 2) adds the pixel below it (MS); bit 0 of M subtracts the pixel, bit 1 subtracts MS. |
$A001 (register 1) | 7 | N | Vertical-edge exclusive mode; also changes the capture time (below) and, if 1, exposure should be at least $0030. |
$A001 | 5–6 | VH | Vertical/horizontal edge enhancement mode select. |
$A001 | 0–4 | G | Output gain (table above). |
$A004 (sensor register 7) | 4–6 | edge ratio | Index into the ratio table α = 0.50, 0.75, 1.00, 1.25, 2.00, 3.00, 4.00, 5.00 (index 0 to 7). |
$A004 | 7 | E3 | Part of the filtering-mode selector (below). |
$A004 | 3 | I | Invert: the sample code inverts the sensor image (255 − value) before the filtering when set. |
Filtering mode. The sample code forms (N << 3) | (VH << 1) | E3 and handles these values: 0x0 1-D filtering (the picture is combined with the row below using P and M); 0x2 1-D filtering plus horizontal enhancement, where each pixel becomes P + (2P − (MW + ME)) × α (west and east neighbours) before the 1-D step; 0xE 2-D enhancement, P + (4P − (MN + MS + ME + MW)) × α, with no 1-D step;
0x1 gives one colour always (“in my cartridge this is always the same colour”; the sensor datasheet does not document it, so maybe a bug); any other value is reported by the sample code as unsupported and left unfiltered. Pan Docs says the sample covers “all used configurations” of edge handling; the behaviour of the other combinations on real hardware is not documented there.
Picture in RAM. The sensor image is 128 × 128 but its first and last 8 rows are corrupted, so the controller uses the 112 middle rows for the 128 × 112 picture (the sample code itself keeps a 120-row sensor buffer and starts reading it 4 rows down, a simplification of its own that Pan Docs does not explain). It is stored as 14 × 16 tiles (14 rows of 16 tiles), each tile in the usual Game Boy 2 bits per pixel format, copied to cartridge RAM bank 0 starting at offset $0100; the output colour is 3 − (value >> 6), so colour 3 is the darkest from the matrix’s thresholds. 14 × 16 tiles × 16 bytes is 3584 bytes.
The first part of the sample converts the sensor’s greyscale, “adapting” to a 3.1/5.0 V level, with the exposure value scaling the brightness (the sample divides by $0300, a value its comment says could be something else); gain and level control are not needed in emulation because webcams do that automatically.
Clock and capture sequence. The cartridge uses the PHI signal (system clock): 1.048576 MHz, 2.097152 MHz in CGB double speed. The sensor’s clock is half of PHI (the sensor handles signals sometimes on the rising and sometimes on the falling edge), which is why exposure values should be doubled in double speed. The sequence, in sensor clocks (multiply by 2 for Game Boy M-cycles):
- reset pulse;
- configure the sensor registers: 11 × 8 = 88 clocks;
- wait 1, start pulse 1;
- exposure: exposure steps × 8 clocks;
- wait 2;
- read: 16128 clocks if N = 1, otherwise 16384;
- wait 3, then a reset pulse to stop the sensor.
Total: 88 + 1 + 1 + 2 + 16128 + 3 = 16223, so CLKs = 16223 + (N ? 0 : 256) + 8 × exposure; in M-cycles 32446 + N term (0 or 512) + 16 × exposure, as above. The sample emulator code (GB_CameraTakePicture) sets CAM_CLOCKS_LEFT = 4 * ( 32446 + ( N_bit ? 0 : 512 ) + 16 * EXPOSURE_bits ), i.e. four times the M-cycle count, and says the emulator should wait that long until bit 0 of $A000 is cleared; Pan Docs does not name the unit of CAM_CLOCKS_LEFT (the factor 4 suggests 4 MHz clock cycles; that is our inference). During the read every pixel is written to RAM as it is read, so a stopped capture leaves the part read so far followed by the earlier picture. If the clock during the read is too slow, the sensor keeps charging and the picture looks as if exposed longer, but brightness does not always keep rising (there seems to be a limit).
Sensor processing order: edge control first, then gain, then level; the result is the analogue output on the Vout pin. The sensor responds to infrared, so pictures can look strange next to those of other sensors and emulation cannot be perfect.
Pan Docs derives all of this from Antonio Niño Díaz’s reverse engineering of the cartridge (gbcam-rev-engineer), read here only through Pan Docs’ raw Gameboy_Camera.md (one source; not compared with the upstream repository or the sensor datasheet). Two typos in Pan Docs’ text (the repeated gain code and the repeated matrix labels) are noted above.
The seven figures in words
Pan Docs’ Gameboy_Camera.md ends its register section with seven PNG figures (imgs/gbcamera/fig1.png to fig7.png, copied to samples/gb/sources/pandocs-more/gbcamera, CC0; they come from the M64282FP datasheet material Pan Docs cites). The figures were opened and read by us; what follows is a description in words and numbers, not a reproduction. “N VH1 VH0 E3” is the four-bit mode shown above each example (N is bit 7 of $A001, VH the two bits 6–5, E3 bit 7 of $A004); each example shows a 3 × 3 kernel applied to the pixel P and its neighbours (north MN, west MW, east ME, south MS; the diagonals are not used) and the test picture it produced (a plus, a circle, a square and a triangle, grey on white).
| Figure | Caption | Mode (N VH1 VH0 E3) | Kernel (rows top to bottom) | What the example picture shows |
|---|---|---|---|---|
| 1 (left) | Horizontal edge processing modes | 0 0 1 1 | [0 0 0] [−1 2 −1] [0 0 0] | the picture is grey with only the left and right edges of the shapes drawn (vertical line segments, light on one side and dark on the other); the horizontal edges vanish. The left of the figure also draws the neighbourhood the kernel is applied to: a 3 × 3 box with 0, MN, 0 / MW, P, ME / 0, MS, 0 |
| 1 (right) | (same) | 0 0 1 0 | [0 0 0] [−1 3 −1] [0 0 0] | the original picture with its left and right edges sharpened (the shapes grey, with a thin bright and dark edge at their sides) |
| 2 (left) | Vertical edge processing modes | 1 1 0 1 | [0 −1 0] [0 2 0] [0 −1 0] | grey picture with only the top and bottom edges drawn (horizontal line segments) |
| 2 (right) | (same) | 1 1 0 0 | [0 −1 0] [0 3 0] [0 −1 0] | the picture with its top and bottom edges sharpened |
| 3 (left) | 2D edge processing modes | 1 1 1 1 | [0 −1 0] [−1 4 −1] [0 −1 0] | grey picture with the outlines of all four shapes (edges in every direction) |
| 3 (right) | (same) | 1 1 1 0 | [0 −1 0] [−1 5 −1] [0 −1 0] | the picture with all its edges sharpened |
| 4 | 1-D filtering hardware | — | — | a block diagram: a “P scanner” and an “M scanner” (vertical strips beside the pixel area, each with a one-bit shift arrow) feeding a “P register” and an “M register” (bits P0–P3 and M0–M3, each four cells), an “X scanner” under the pixel area with an “X register” (bits X0–X3), a 4 × 1 filter at the pixel origin (the bottom-left corner of the pixel area), and the pixel area itself; the scanning direction is drawn as two solid arrows left to right with a dotted return arrow, one row after another |
| 5 | Positive image | — | filter +1 | the registers hold P = bit 0 only (P0 = 1, the rest 0) and M = 0; the X register 1 0 0 0; the 4 × 1 filter outputs +1 at the bottom cell and 0 above; the resulting picture is the normal positive image: black shapes on a white ground |
| 6 | Negative image | — | filter −1 | P = 0 and M with its bit 0 set (M0 = 1); X 1 0 0 0; the filter outputs −1 at the bottom cell; the picture is the negative: white shapes on a black ground |
| 7 | Edge extraction | — | filter +1 and −1 | P with bit 1 set (the second cell, P1 = 1) and M with bit 0 set (M0 = 1); the filter outputs +1 at the third cell and −1 at the bottom; the picture is grey with only the edges, here horizontal edges, light where the pixel is brighter than the one below and dark where it is darker |
How this fits the sample code (above): the P and M values it derives from $A000 bits 1–2 are the bits of the P and M registers of figures 5 to 7 (value 1 for P adds the pixel, value 2 adds the pixel below; the same for M with subtraction), so figure 5 is P = 1, M = 0 (the sample’s case 1), figure 6 is P = 0, M = 1 (the sample’s case 0), and figure 7 is P = 2 (the pixel below), M = 1 (the pixel itself) in the way the figure draws them, which differs from the sample’s case 2 (P = 1, M = 2: the negative edge direction); that is our reading of the figures against the sample code and it is not stated by Pan Docs. The mode examples of figures 1 to 3 give the kernels the 4-bit mode selects for the edge-enhancement arithmetic (centre weight 2 or 3 for 1-D modes and 4 or 5 for the 2-D modes: the lower value extracts the edges, the higher value keeps the picture and adds the edges); that is how the examples read, and the sample code’s formulas (P + (2P − (MW + ME)) × α, P + (4P − (MN + MS + ME + MW)) × α) match the kernels with the ratio α scaling the edge part.
TAMA5
Bandai’s controller (cartridge type $FD), with a real-time clock and a small RAM.
Pan Docs does not describe it. What follows is taken mainly from the source code of the mGBA emulator (round 26G: the real-cartridge reads from the FlashGBX reader, mGBA issue #2041 and the gbdev forum thread 469 are now cited too, see Real-cartridge evidence, and they contradict the mGBA page model at one point, the class 4 reads) (src/gb/mbc/tama5.c and
include/mgba/internal/gb/memory.h, with src/gb/mbc.c and include/mgba/internal/gb/mbc.h for the set-up and the save buffer; MPL 2.0, tama5.c read raw again on 2026-11-19, copies in the sample sources), which was itself written from reverse engineering. It is therefore an emulator’s model and not hardware documentation; the points
marked inferred are our reading of that code. No hardware document was found. A second implementation exists, in MAME, and is compared with this section under The MAME model below; it agrees on the port layout and the RAM commands and covers far less (no clock), so the clock model still rests on mGBA alone. SameBoy and Gambatte have no TAMA5.
The viewer assumes a 16 KiB window at $4000 (the bank number is built from two nybbles, so up to 256 banks).
Access
Everything is at $A000–$BFFF (writes to $0000–$9FFF are ignored by the mGBA model). The cartridge is driven with
4-bit values through two ports, chosen by address bit 0:
- odd address (
$A001): write the register number to talk to (8-bit value, kept); a read returns$FF; - even address (
$A000): a write stores the low 4 bits into the selected register (numbers 0–7 only); a read returns data for the selected register, with the upper nybble set to 1s ($F0| nybble).
| Register | Write | Read |
|---|---|---|
| 0 | ROM bank, low nybble; switches the bank at $4000 to (register 1 << 4) | register 0 each time register 0 or 1 is written | — |
| 1 | ROM bank, high nybble | — |
| 4 | data to write, low nybble | — |
| 5 | data to write, high nybble | — |
| 6 | command select: bit 0 is bit 4 of the address, bits 1–3 the command class | — |
| 7 | address, low nybble; writing it executes the command chosen by register 6 | — |
| $A | (not writable here) | always $F1 (inferred: a “ready” status polled by the game) |
| $C | — | result nybble, low half of the byte |
| $D | — | result nybble, high half of the byte |
| any other number (0–9, $B, $E, $F) | numbers 8 and above are not stored (mGBA logs an unknown write) | a read with such a register selected returns $F1, the same value as for $A; mGBA logs it as an unknown read (tama5.c, the default case of _GBTAMA5Read) |
The command address is a 5-bit value: (register 6 & 1) << 4 | register 7. The data byte is register 5 << 4 | register 4. The command class is register 6 >> 1:
| Class | Action | |
|---|---|---|
| 0 | write the data byte into the cartridge RAM at the 5-bit address (32 bytes; the save file) | |
| 1 | select RAM read: a read of $C and $D then returns the RAM byte at the address | |
| 2 | clock commands, by address: $00 disable the timer (clears bit 3 of the page register in all four pages), $01 enable it (clears the seconds, sets bit 3 in all four pages), $04 write the minutes from the data byte (BCD, tens in the high nybble), $05 write the hours,
$06 read the minutes, $07 read the hours (BCD), $10 disable the alarm (clears bit 2 in all four pages), $11 enable the alarm (sets bit 2 in all four pages). A read of $C/$D after any other address in this class returns the 5-bit address itself (the code’s default case). Every such read first advances the clock (see below). | |
| 3, 5, 6, 7 | unknown: a write that executes with one of these classes only logs “unknown address” and changes nothing | a read of $C or $D with one of these classes selected logs “unknown read” and returns the default nybble 0 (low port $F0, high port $FF); the same holds for class 0 (a RAM write class has no read) (tama5.c; what the real chip does with these classes is not known) |
| 4 | clock register page access, chosen by register 7: writes with register 7 = 0, 2, 4, 6 go to the timer, alarm, free 0 and free 1 page; the index is register 4 and the nybble written is register 5. A write whose index is $D or more is ignored. Timer-page values are ANDed with the mask table below at the index, alarm-page values with the entry at index | $10; the two free pages are stored unmasked.
Real cartridge (corrected in round 26G): the FlashGBX reader, which works on real TAMA5 cartridges, reads four pages with register 7 = (page<<1)+1, that is 1 = timer, 3 = alarm, 5 = free page 2, 7 = free page 3 (page number = register 7 >> 1). That is the layout to trust; the mGBA behaviour in the next paragraph is the emulator’s model and is contradicted by it for register 7 = 3, 5 and 7.
mGBA’s reads with register 7 = 1, 3, 5 and 7 all return the nybble of the timer page at the index in register 4 (mGBA does not read the alarm or free pages back through this route); with register 7 = 0, 2, 4 or 6 no case matches, so the nybble is 0 (port $C returns $F0); an index above $D reads 0 (index $D itself is allowed on reads). Only the low-nybble read port $C works here: reading port $D logs “reading RTC incorrectly” and returns $FF. Every such read first advances the clock. |
Clock registers
The clock is organised as 16-nybble pages. Page 0 is the running time and page 1 the alarm and options; pages 2 and 3 are free memory (mGBA keeps four pages: timer, alarm, free 0 and free 1).
| Index | Page 0 (time) | Page 1 (alarm) |
|---|---|---|
| 0, 1 | seconds, ones and tens | — |
| 2, 3 | minutes, ones and tens | minutes |
| 4, 5 | hours, ones and tens | hours |
| 6 | day of the week | day of the week |
| 7, 8 | day of the month, ones and tens | day of the month |
| 9, A | month, ones and tens | — |
| B, C | year, ones and tens | — |
| A | — | 24-hour flag |
| B | — | leap-year counter |
| D | page register of each page. Bit 3 = timer enabled and bit 2 = alarm enabled (the timer and alarm commands set and clear these bits in all four pages together; their meaning is inferred from the names of the commands). The low two bits hold the page’s own number, see “Start values” below. Writes at index $D or above are ignored, so only the timer and alarm commands change it. | |
| E, F | test and reset (names only; mGBA does not act on them) | |
The clock chip is called a TAMA6 in the emulator’s names. Values are masked to the bits each register can hold (for instance the tens of seconds are 3 bits). Whether the real chip’s bits behave exactly as the emulator’s masks is not known from this source.
Write mask table
mGBA’s _tama6RTCMask[32] (tama5.c lines 12–16). Index 0–15 is used for writes to the timer page, index 16–31 (the alarm page’s index plus $10) for writes to the alarm page. A write stores value AND mask.
| Page | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Timer (index 0–15) | F | 7 | F | 7 | F | 3 | 7 | F | 3 | F | 1 | F | F | 0 | 0 | 0 |
| Alarm (index 16–31) | 0 | 0 | F | 7 | F | 3 | 7 | F | 3 | 0 | 1 | 3 | 0 | 0 | 0 | 0 |
So the timer page holds seconds ones 0–15, seconds tens 0–7, minutes ones, minutes tens 0–7, hours ones, hours tens 0–3, weekday 0–7, day ones, day tens 0–3, month ones, month tens 0–1, year ones and tens 0–15; the alarm page has no seconds, month or year, a 1-bit 24-hour flag at $A and a 2-bit leap-year counter at $B. (All in hex; the masks are mGBA’s, hardware not checked.)
Start values and save file
- Page register start values. When the mapper is set up, mGBA writes 1, 2 and 3 into the page register (index
$D) of the alarm, free 0 and free 1 pages (mbc.c lines 483–485). The timer page’s register is not set there, so it starts at 0 if the state starts zeroed (inferred). The values 0, 1, 2, 3 are thus the pages’ own numbers. - Save layout. The cartridge RAM is
$20(32) bytes. The save file is that RAM, then a 40-byte suffix: the four pages in the order timer, alarm, free 0, free 1, each 8 bytes (16 nybbles, index 2k in the low nybble and 2k+1 in the high nybble of byte k, so$D–$Fare included), then the “latched” Unix time as a 64-bit little-endian value. A file shorter than that suffix loads with the timer enabled and empty pages. On loading, the timer is marked disabled unless bit 3 of the timer page register is set; the page registers are then reset to their page numbers (timer: bits 2–3 kept; alarm, free 0 and free 1: bits 2–3 kept and the page number 1, 2 or 3 set). - Clock advance model. The clock is not running: on every read of the clock (the class 2 read commands and the page reads above) mGBA takes the Unix time from its RTC source, subtracts the time of the last such read, and adds the difference to the timer page. Nothing happens if the difference is 0 or the timer is disabled (the last-read time is still updated). The addition carries seconds into minutes into hours into days. If the alarm page’s 24-hour flag (
$A) is clear, the hour-tens nybble is read as bit 0 = tens digit and bit 1 = PM; in code the value added for the PM bit is(hour10 & 2) * 12, which is 24 and not 12 (it looks inconsistent with the write-back, which stores(hour % 12) / 10 + (hour / 12) * 2; our reading, not verified). The date uses the leap-year counter (alarm page$B, 0–3, leap when its low 2 bits are 0) to find day-of-year from day and month, steps whole years (stepping backwards it tests the leap counter,leapYear & 3, but stepping forwards it tests the displayed year,year % 4, so the two directions can disagree when the counter and the year are out of step; tama5.c lines 147–165, as coded), and writes day, month and year back, the year modulo 100. The weekday is set to(weekday + new day-of-year) % 7as coded, which is not the elapsed number of days (again our reading of the code).
The MAME model (a second source)
Source: MAME src/devices/bus/gameboy/tama5.cpp (BSD 3-clause, copyright Vas Crabb and Wilbert Pol; the raw file is in samples/gb/sources/mame, fetched from GitHub on 2026-11-19). MAME calls its status “partially supported”. Its header comment describes the cartridge’s chips, which mGBA’s source does not: the TAMA5 bus interface, a “TAMA6” Toshiba TMP47C243M TLCS-47 microcontroller, a “TAMA7” mask ROM, a Toshiba TC8521AM real-time clock and a Toshiba M62021P reset IC with a memory-backup switch; the microcontroller sits between the TAMA5 and the clock and can drive a piezo speaker (alarms from the clock), which a mechanical switch can disconnect; clock, microcontroller and speaker run from a user-replaceable CR2016 cell. The comment says that the TAMA5 only responds to address lines A15, A14 and A0 and data lines D3–D0, “i.e. addresses are effectively masked with $C001, and data is effectively masked with $0F”.
| Point | mGBA (this page) | MAME |
|---|---|---|
| Ports | $A001 register select, $A000 data | the same: $A001 is the “command” port and $A000 the data port (installed with a mirror over $A000–$BFFF, which agrees with the $C001 mask) |
| Register numbers | 0, 1, 4, 5, 6, 7 written; $A, $C, $D read | the same set; any other command logs “unknown command” |
| ROM bank | register 0 = low nybble, register 1 = high nybble (4 bits, 256 banks); start bank 1 | register 0 = low nybble; register 1 uses only bit 0 of its value as bit 4 (5 bits, 32 banks = 512 KiB); start bank 1 |
| Data bytes | register 4 low nybble, 5 high nybble of the byte | the same (m_data) |
| Address | register 6: bit 0 = address bit 4, bits 1–3 = class; register 7 = low nybble and executes | register 6 is the high nybble of an 8-bit address, register 7 the low nybble and the trigger; the “class” is the top three bits (address & $E0), so MAME’s class bits are mGBA’s register-6 bits 1–3 and the address bit 4 is the same bit |
| Class 0 (write) | store the data byte in the 32-byte RAM | $00: m_registers[address & $1F] = m_data (32 bytes, filled with $FF at reset) |
| Class 1 (read) | select RAM read, result in $C/$D | $20: m_data = m_registers[address & $1F], result read by $C (low nybble) and $D (high nybble) |
Ready status ($A) | a read of $A000 returns $F1 for register $A | writing $0A to $A001 sets the response to $01: “the lowest 2 bits of $A000 … value 01 means ready”; the data port returns open bus in bits 7–4 and the response in bits 3–0 |
| Class 2 (clock) | clock commands by address ($00, $01, $04–$07, $10, $11); other addresses return the address | not implemented: logged “unknown access”; the one special case is address $12, which sets the data to $FF (the code at game address $1A19 reads it and branches on a result of $0F, where mGBA would return $02 for $12) |
| Class 4 (clock pages) | page access: reads and writes of timer, alarm and free pages by index | not implemented (the header comment calls it “some kind of read command” seen at $1B5B, followed by a read of $C; mGBA reads the seconds there) |
| Classes 3, 5, 6, 7 | unknown, logged | unknown, logged (“not encountered yet” in MAME’s comment) |
| The clock itself | an emulated TC8521-like clock, masks, BCD, leap counter, advanced on reads from the host time | none: MAME gives no running time; the real-time clock chip is only named |
What this second source settles. The two-port layout, the 4-bit data path, the command and trigger scheme, the 32-byte RAM and its class 0/1 commands, the $A status and the $C/$D reads are seen in two independent implementations (written by different authors from different observations) and agree; the cartridge’s chips and the address mask are named by MAME. What it does not settle: the clock model (masks, BCD, the leap counter, the advance code) rests on mGBA alone; MAME and mGBA differ on the width of the ROM bank (5 or 8 bits; the one released game’s ROM is 512 KiB according to MAME’s 5-bit mask, our inference) and on address $12 of class 2; the classes 3, 5, 6 and 7 are unknown in both. A third implementation, Gearboy’s TAMA5MemoryRule.cpp (GPL 3, read raw), has the same class and page structure with comments naming the timer page, the alarm page, RAM write and read, RTC commands and “RTC page direct access”; it looks modelled on mGBA’s code (our reading, not compared line by line), so it is not counted as independent. No hardware document was found (searches: a web search for TAMA5 registers, Pan Docs, the gbdev wiki, a gbdev forum thread on the Tamagotchi 3 chip set that was not opened; the thread was read in round 26D and again in round 26G, see below).
Real-cartridge evidence (round 26G)
Sources read on 2026-12-03, summarised in our words. Kinds of evidence are stated for each; none is a decapped ROM dump.
- FlashGBX (Lesserkuma; reader code used on real TAMA5 cartridges): reads the four clock pages through class 4 with register 7 =
(page<<1)+1. This fits real cartridges and does not fit the mGBA model, which returns the timer page for all four reads. - mGBA issue #2041 (Lesserkuma): nibble dumps taken from a real cartridge, used for the page layout above.
- gbdev forum thread 469 (posts by endrift, Tauwasser, skaman, CasualPokePlayer and Lesserkuma, 2017 to 2022): Tauwasser identifies the chips (TAMA5 interface, TAMA6 Toshiba TMP47C243M 4-bit microcontroller, TAMA7 mask ROM, TC8521AM clock); commands decoded:
$40/$41timer enable and seconds reset,$44minutes,$45hours,$46/$47read minutes and hours,$50/$51alarm off and on;$43was seen and is unknown;$70–$7Flook like open bus echoing the address (the author is unsure); on a real cartridge a 1997 save counts the year$F0to$F9then$20, 1998–99 gives$19, and 2000 on gives$20to$99then$00. The TAMA6 was decapped and its ROM is being imaged (a post links a tweet; no binary has been published). - MAME
tama5.cpp(re-read raw on 2026-12-03): no clock at all; its header notes the unknown sequences at game addresses$1B5B(register 4 = 0, 6 = 8, 7 = 1, read$C, then the same with register 4 = 1) and$1A19(6 = 5, 7 = 2, read$C,$0Fmeans a different branch); address$12is forced to$FF; ROM bank is 5 bits.
Contradiction stated: mGBA (emulator model) returns the timer page for register 7 = 1, 3, 5, 7; FlashGBX (real cartridges) uses all four. This page now follows the real-cartridge read for class 4. The mask table, BCD and leap-counter behaviour still rest on mGBA alone.
Power-on state of the other controllers, from emulators
Pan Docs states power-on values for the MBC1, MBC2, MMM01 and the camera only (in the raw files read). For the others the emulators’ reset code, read in the raw sources, gives a consistent picture; it is an emulator convention, not a measurement of the chips, and Pan Docs and the hardware are silent:
| Controller | ROM bank at $4000 after reset | RAM | Source |
|---|---|---|---|
| MBC3, MBC30 | 1 (register 0 acts as 1) | disabled, bank 0; clock registers unlatched | SameBoy GB_reset_mbc (mbc_rom_bank = 1); Gambatte Mbc3 (rombank_(1), rambank_(0)); mGBA state zeroed, bank 1 shown |
| MBC5 and the camera | 1 (low byte 1, ninth bit 0) | disabled, bank 0 | SameBoy (rom_bank_low = 1); mGBA (romBank = bank 1) |
| MBC6 | 8 KiB banks 2 and 3 in windows A and B (mGBA); Pan Docs gives none | RAM banks 0 and 1 as written in the reset code (it calls the half-bank switch twice with half 0, which looks like a typo for half 1: our reading) | mGBA reset code |
| MBC7 | bank 1 (mGBA); SameBoy’s MBC7 branch sets only the accelerometer latch to $8000 and the EEPROM state | disabled; both enables clear; latch $8000 (Pan Docs: both axes read $8000 before the first latch) | SameBoy GB_reset_mbc, mGBA |
| HuC1, HuC3 | 1 | HuC3: mode 0 (RAM read-only), RAM bank 0; HuC1: the reset code read does not say | Gambatte HuC3(…, rombank_(1), rambank_(0), ramflag_(0)); mGBA reset (mode 0) |
| TAMA5 | 1 | the 32 registers at $FF (MAME); the mGBA save is zeroed | MAME device_reset, mGBA |
| M161 | 32 KiB bank 0; the one allowed switch not yet used | none | Pan Docs, Gambatte, mGBA |
| EMS, Gearboy’s model | 1, OR mask 0, configure mode off, RAM enabled in the model (the Gearboy code sets m_bRamEnabled = true; not a statement about the cartridge) | bank 0 | Gearboy FlashcartMemoryRule::Reset |
A second reference: Game Boy: Complete Technical Reference
Source: Joonas Javanainen (Gekkio), “Game Boy: Complete Technical Reference” (gb-ctr, CC BY-SA 4.0), the raw Typst files chapter/cartridges/*.typ (kept in samples/gb/sources/gb-ctr, SHA-256 in the sample README; read in full, our own wording). It is based on the author’s own research of the chips, on Tauwasser’s notes and on Pan Docs, and says so. Its MBC6, MBC7, MMM01 and TAMA5 chapters are one-line stubs (“TODO”), the HuC-1 and HuC-3 chapters give only sizes, so for those nothing is compared. Mesen 2’s mapper headers (Core/Gameboy/Carts/*.h, raw copies in samples/gb/sources/mesen-carts) are used as a fourth emulator for the points below.
- MBC1. It agrees with Pan Docs on the four registers (RAM gate with
$Ain the low nibble; 5-bit BANK1 where a written 0 becomes 1; 2-bit BANK2; one mode bit), on banks$20,$40and$60being reachable only at$0000–$3FFFin mode 1, and on the address-bit tables. It adds a warning that the usual names “ROM banking mode” and “RAM banking mode” mislead, because mode 1 also changes ROM reads on multicarts and on 8 and 16 Mbit ROMs. It says the ROM pins of a smaller chip simply ignore the upper bank bits, and that RAM is usually one 8 KiB bank. A disabled or missing RAM reads the undriven bus value. - MBC1M. The same board facts as the section above: bit 4 of BANK1 is not connected, so the bank number is 6 bits, BANK2 acts as the game number, and mode 1 selects the game for
$0000–$3FFF. It says all known multicarts use 8 Mbit ROMs, so there is no known wiring for other sizes, and that the game selection menu runs from game 0 at reset. For detection it gives a different heuristic from Pan Docs’: test the logo at the four file offsets$00104,$40104,$80104and$C0104(BANK2 values 0 to 3 with BANK1 = 0), treat the cartridge as a multicart if proper logo data exists for most of them, and remember that a multicart may hold just two games so one location can be empty. Pan Docs’ test, and the explorer’s, looks at bank$10(offset$40104) only. - MBC2. It agrees on the registers (selected by address bit 8: clear = RAM gate, set = ROM bank; 4-bit ROM bank where 0 becomes 1; up to 16 banks), on the 512 half-byte RAM with no banking whose address wraps (
$A000equals$A200), and on the upper four bits of a read being undriven (“usually 1 but should not be relied on”). The ROM bank register is only 4 bits and zero is adjusted like MBC1’s BANK1. - MBC3 and MBC30. The MBC3 chapter gives only the size limits (16 Mbit ROM, 256 Kbit RAM in 4 banks) and the clock. The MBC30 chapter says: up to 32 Mbit of ROM (256 banks of
$4000bytes) and 512 Kbit of RAM (8 banks of$2000bytes), otherwise almost identical to the MBC3, used by the Japanese Pokémon Crystal; the board has a 1 Mbit RAM chip but one address pin is unused, so half of it cannot be reached. These are the sizes behind the 8-bit ROM and 3-bit RAM bank widths in the MBC30 section above. The chapter does not state the register widths themselves. - MBC5. The registers agree: an 8-bit lower ROM bank at
$2000–$2FFF(reset value 1), a 1-bit upper bank at$3000–$3FFF, a 4-bit RAM bank at$4000–$5FFF, up to 512 ROM banks and 16 RAM banks. One point disagrees with Pan Docs. Pan Docs says that real chips enable the RAM for any value with$Ain the low four bits ($0A,$1A…). gb-ctr says the MBC5 RAM gate is a full 8-bit register and only%00001010($0A) enables; every other value,$8Afor example, disables. SameBoy (memory.cline 874,value == 0x0A), Mesen 2 (GbMbc5.hline 56,value == 0x0A) and mGBA (_GBMBC5:0disables,$Aenables, other values only logged as unknown) agree with gb-ctr’s reading in what they enable; SameBoy’s MBC1, MBC2, MBC3 and MMM01 use the low-nibble test instead. Gambatte (mbc5.cppline 38,data == 0xA, while its MBC1, MBC2, MBC3 and plain-ROM code use(data & 0xF) == 0xA) and MAME (mbc.cppline 219,0x0a == datafor MBC5; the nibble test at line 597 belongs to another mapper) read it the same way, so five emulators and gb-ctr say$0Aonly and Pan Docs alone says the low nibble. No source cites a measurement for either side; the Mooneye mapper tests cover banking, not the gate value. Pan Docs itself advises not to rely on its wider rule. Round 21 ran an own probe ROM (write$22under each gate value, read back, reopen with$0A, read again) on two more cores: Gearboy opens only for$0A(like SameBoy and Gambatte), binjgb opens for$0A,$1A,$8A,$AA,$FAand$2A(the low-nibble rule). The emulators are split, which is why this stays a reading of documents. None of these is a measurement visible here, so the real chip’s answer for values such as$1Ais taken from gb-ctr’s chip research; the explorer’s MBC5 text above keeps Pan Docs’ wording and this section is the correction. - Rumble. gb-ctr’s RAMB register has 4 bits and does not mention the motor. SameBoy, for a cartridge with a motor, toggles the motor on bit 3 and masks the RAM bank with 7 (
memory.c878-884), the reading the MBC5 section above marks as our inference.
Evidence: gb-ctr is one author’s chip-level research (CC BY-SA 4.0), not a Nintendo document, and the Mesen 2 and SameBoy lines are emulator source. No hardware was available here.
Sources
- MBC1, MBC2, MBC3, MBC5, MBC6, MBC7, MMM01, HuC1, HuC3, Game Boy Camera – Pan Docs. Every section on this page was re-read as raw Markdown (CC0) on 2026-11-14:
MBC1.md,MBC2.md,MBC3.md(with MBC30),MBC5.md,MBC6.md,MBC7.md,MMM01.md,HuC1.md,HuC3.md,Gameboy_Camera.md,othermbc.md(Wisdom Tree, EMS, Bung, MBC1M board note) andMBCs.md(timing, unmapped RAM). The earlier “read 2026-11-13” citations (a rendered page, not the raw file) for MBC1, MBC2, MBC3 and MBC5 are replaced by these. The files are kept in the site’s sample sources (samples/gb/sources/pandocs) with their SHA-256 in the sample README. - raw MBC7.md, MBC6.md, HuC3.md, Gameboy_Camera.md, MMM01.md – the Pan Docs source files
- mGBA tama5.c and memory.h – the source of the TAMA5 clock model (emulator source, MPL 2.0); MAME tama5.cpp (BSD 3-clause) is the second source for the ports, commands and RAM
- Emulator sources read raw for the comparisons (kept in
samples/gb/sources, recorded insamples/gb/README.md): mGBAmbc.c,licensed.c,huc-3.c,main.c,memory.h(MPL 2.0); SameBoyCore/mbc.c,memory.c,gb.h,camera.c(MIT); Gambatte, pokemon-speedrunning fork,mmm01.cpp,m161.cpp,huc1.cpp,huc3.cpp,huc3_chip.cpp,mbc1.cpp,mbc3.cpp,wisdom_tree.cpp,pakinfo.cpp(GPL 2); GearboyFlashcartMemoryRule.cpp,MBC6MemoryRule.cpp,MMM01MemoryRule.cpp,TAMA5MemoryRule.cpp,HuC1MemoryRule.cpp,HuC3MemoryRule.cpp,MBC7MemoryRule.cpp,MBC3MemoryRule.cpp,Cartridge.cpp(GPL 3). They were read, not copied into pages; each statement above says what the code does. - EMS FAQ by nitro2k01 (Didrik Madheden), v1.1, 2013 – the second source for the EMS mapper; read through the fetch tool, which returns a summary, so the EMS paragraph is our words; the file is not stored.
- Pan Docs in turn cites: the 93LC56 datasheet (MBC7 EEPROM), the Nintendo Power GB Memory cartridge notes (the same flash chip as the MBC6), and gbcam-rev-engineer (the camera); those were not read here.
Not described
Known, not yet covered
- The Game Boy Camera’s sensor bit meanings beyond what the sample code reveals (for example what the VH values mean physically). The seven edge-processing figures are now written out under The seven figures in words (read from the PNGs by us); the register bits, filtering modes, picture layout, capture sequence, part table (U1 to U3), linear gains and the sample code’s CAM_CLOCKS_LEFT formula are described, from Pan Docs only.
- Emulator files that were fetched and cited but not compared line by line with Pan Docs: Gearboy’s MBC6 flash state machine, MMM01, HuC1, HuC3, MBC7 and TAMA5 rules (the comparisons above are against mGBA, SameBoy, Gambatte and MAME, which were read for the points named).
- The MBC5 rumble drawings are described in numbers under The two rumble waveforms in numbers; the rise and fall times of the voltage are not described.
Unknown
- The Bung mapper: no register or behaviour description exists in any source found (Pan Docs: detection value
$BEonly). Searched again on 2026-11-26: every cartridge chapter of Gekkio’s reference has no Bung text; Mesen 2’s cartridge folder (Core/Gameboy/Carts: MBC1, MBC2, MBC3, MBC5, MBC6, MBC7, MMM01, HuC1, M161, Wisdom Tree) has neither Bung nor EMS; the gbdev wiki could not be reached from here (curl returned code 000). Gearboy treats it as the EMS mapper; no document confirms that. - Bung, round 26F (new facts, still no register description): the FlashGBX project’s Doctor GB Card profiles (
LK_Device.py,Flashcart.py; kind of evidence: working cartridge-reader code used on real Bung flash cartridges) address the Bung 16M flash through mapper type0x1B, a bank register at$2000and flash commands at$6AAAand$5554. This describes how a flasher reaches the flash chip, not how a game sees the multicart mapper, so the Bung mapper’s own registers stay unknown. Searched without a result: Mesen 2 tracker, Gekkio’sgb-ctrsource (no Bung chapter). - The EMS mapper on authentic hardware: Pan Docs marks it unverified. The EMS FAQ (nitro2k01) and Gearboy agree on the OR mask and bank register but differ from Pan Docs on whether the configure mode is needed (revision 1 versus revision 2 and the 64M cartridge); no EMS cartridge was available to decide.
- EMS, round 26F (game ROM analysis, not a hardware measurement): the menu ROM that ships with the ems-flasher tool (
menu.gb, from thechastai/menugbsubmodule ofmikeryan/ems-flasher) was disassembled with the site’s SM83 decoder (probescripts/gb/fix26f-ems-menu-writes.mjs). Its start-game stub writes the configure sequence ($A5and$98in the configure mode, as Pan Docs says for the revision 2 and 64M cartridges) and a write to$7000with the value$08on the 64M cartridge’s bundled menu. Round 26G ruling: this start-game stub is settled for the 64M cartridge only (game ROM analysis of the vendor’s own menu); it does not show whether revision 1 cartridges need the configure mode, so that disagreement stays open. The tool’sTechtext was saved beside the ROM inresearch/gb-docs/ems-flasher-26f/. - MBC30: the real chip’s register widths. Three emulators agree (8-bit ROM bank, 3-bit RAM bank) and Gekkio’s hardware research (Game Boy: Complete Technical Reference, MBC30 chapter; kind of evidence: reverse-engineering of the real chip) states 256 ROM banks and 8 RAM banks, which fixes the usable widths at 8 and 3 bits. The usable RAM bank range 0–7 is now also shown by game ROM analysis (Pocket Monsters Crystal JP uses RAM banks 4, 5, 6 and 7 at 155 constant call sites of
$2F9D; static analysis, the game was not run). Whether the chip’s registers are physically wider than these usable widths is not stated anywhere, so the physical width stays Unknown. - MBC5: whether the real RAM gate accepts values other than
$0A(Pan Docs: any value with$Ain the low nibble; Gekkio’s reference, SameBoy, Mesen 2, mGBA, Gambatte and MAME:$0Aonly). No measurement is reproduced here. Routes tried (round 18): Pan Docs, gb-ctr, the Mooneye and Gambatte test sets, six emulator sources; a hardware answer needs a real MBC5 cartridge with a RAM chip: write$1A(and$8A) to$0000–$1FFF, write a pattern to$A000, then read it back, or watch the RAM chip-select line with a logic analyser while writing those values. Evidence found since round 18, none of it a measurement of the chip, so the point stays Unknown (owner decision, round 26): Nintendo’s own MBC5 datasheet (copy inresearch/gb-docs/cgbmbc5-reinerziegler.pdf) says “Access to external extended RAM is enabled by writing 0Ah in the RAMG register space from 000h to 1FFFh. If anything other than 0Ah is in this register, then read and write to RAM is disabled” (a manufacturer document, supporting$0Aonly); the MiSTer Gameboy core (an HDL written from documents and tests,research/gb-hdl/MiSTer-Gameboy-mbc5.vline 80:cart_di == 8'h0A) compares the full byte for MBC5 and the low nibble for MBC1; the ares source (ares/gb/cartridge/board/mbc5.cppline 40:data.bit(0,3) == 0x0a) tests the low nibble; own probe ROMs showed that DocBoy and Mednafen open on a low nibble of$A(as do GameRoy and Peanut-GB by their source), while MAME opens only for$0A, like SameBoy, Gambatte, Gearboy and Mesen 2. Game ROM analysis of the 1832 MBC5 cartridges of a No-Intro Game Boy Color set (static scan of constant stores to$0000–$1FFF, round 24) found one licensed game that writes a value other than$00/$0Awith a low nibble of$Ain confirmed code: B-Daman Bakugaiden V – Final Mega Tune (Japan), bank 0$0DED–$0DFB(push af;ld a,$1A;ld ($0000),a;pop af;ldh a,($FFA7);ldh ($FFA3),a;ld ($2000),a;ret); no RAM access follows it in that routine, so the game cannot show whether$1Aopens the RAM. The static scan cannot follow indirect writes, so other games could still write such values. - MBC5 gate, round 26F additions (the question stays open). For
$0Aonly: the Nintendo datasheet reading and gb-ctr (Gekkio; its text says it rests on “my MBC5 research” and The Cycle-Accurate Game Boy Docs); Gambatte-speedrun pull request #95 changed the gate to$0Aonly and cites a confirmation by an arbitrary-code-execution payload on Pokémon Yellow run by TiKevin83 (CasualPokePlayer, issues #87 and #95; the posts do not say the run was on real hardware, and Gambatte’s change derives from gb-ctr, so it is not an independent emulator). For the low nibble: Pan Docs and The Cycle-Accurate Game Boy Docs (text at its MBC5 section), with binjgb, DocBoy, Mednafen, GameRoy, ares and Peanut-GB behaving that way; MiSTer HDL compares the full byte. gb-research (Gekkio) holds MBC1B and SM83 material only, nothing on MBC5. No hardware measurement found, so neither reading meets the evidence rule. - MBC7: the maximum accelerometer range of the real sensor. Bank 0 at
$4000and the$B000region are settled by two emulators (bank 0 can be mapped;$B000reads$FF) but not by hardware. - HuC3: the meaning of command
$2(Pan Docs: a status request on the Pocket Family GB2; SameBoy returns 1 for it, mGBA calls it a read-only mode), commands$0and$7, whether RTC location$06exists (SameBoy: days are 4 nybbles at$03–$06; mGBA: 3 nybbles at$13–$15), none checked on hardware. - MMM01: RAM access in unmapped mode and the points Pan Docs marks “to be verified”: three emulators give three different readings (see the table above), none is a statement about the chip. Round 26F: the FlashGBX flasher sequence for MMM01 cartridges is consistent with Pan Docs’ text and adds nothing on either open point; Pan Docs pull request #310 carries no hardware test. gb-ctr’s MMM01 chapter is still a to-do.
- TAMA5: the clock chip’s behaviour (masks, BCD, leap counter, advance code) rests on mGBA alone (MAME has no clock); classes 3, 5, 6 and 7 of the command byte are unknown in both emulators; MAME’s 5-bit ROM bank against mGBA’s 8 bits is undecided; no hardware document found. Round 26F: FlashGBX (reader code used on real TAMA5 cartridges) reads four RTC pages through command class 4 with register 7 set to
(page<<1)+1; that does not fit the mGBA-only page model for reads with register 7 equal to 3, 5 and 7, so the mGBA clock model is contradicted at that point and its page layout stays unsettled. mGBA issue #2041 carries nibble dumps from a real cartridge. Classes 3, 5, 6 and 7 are still unknown. Round 26G: the page now follows the four-page read; thread 469 and MAME were read (see Real-cartridge evidence); the clock chip behaviour, classes 3/5/6/7 and the ROM bank width (5 or 8 bits) still need a TAMA6 ROM dump or real-cartridge probing. - MBC5 gate, round 26G: re-reading the Nintendo datasheet (CGB-06-0001-002A: RAMG opens only with 0Ah, anything else disables), gb-ctr, Gambatte and Mooneye sources, and the visited sites (nitro2k01, Shonumi, Voxel9, Furrtek, gbdev.io) gave no decap, schematic or hardware test. Per the owner’s ruling it stays Unknown, because the sources disagree and none states a real-hardware measurement.
- MBC6 flash commands: from Pan Docs only (mGBA implements none; Gearboy’s state machine was not compared command by command); not checked on hardware.
- M161: no header value to detect it (Pan Docs gives none); the explorer uses Gambatte’s file rule.