The Z80 addresses 64 KB, and the cartridge answers in the lower 48 KB, in three 16 KB slots. A ROM of 48 KB or less is
mapped straight in. A larger one needs a mapper chip on the cartridge: the program writes a page number to a register
and that page appears in a slot. A ROM image does not say which mapper it uses (the header has no field for it), so the
explorer takes the mapper from the options bar, and uses the Sega mapper unless told otherwise. The file is a series of
16 KB pages, page n at file offset n × 0x4000 (after any copier header). This page
follows SMS Power’s page on mappers.
Sega mapper
Used by nearly all games. Four registers sit at 0xFFFC–0xFFFF, in the top four bytes of the
console’s own RAM mirror: a write goes to both the register and the RAM, a read returns only the RAM, so the last value
written can be read back from there. Any ROM page can go into any slot, and up to two 16 KB pages of cartridge RAM can
be mapped into the upper slots.
| Address | Register | What it does |
|---|---|---|
0xFFFC | RAM and control | Bit 7: ROM write enable; 0 write-protects the ROM (no known software uses it). Bits 6–5 unused. Bit 4: maps RAM into 0xC000–0xFFFF (it should be disabled through port 0x3E to avoid bus contention; no known software uses it). Bit 3: maps cartridge RAM into slot 2 (0x8000–0xBFFF), overriding ROM banking there. Bit 2: which of the two 16 KB RAM pages slot 2 shows. Bits 1–0: bank shift. |
0xFFFD | Slot 0 page | The ROM page seen at 0x0400–0x3FFF. Write only. |
0xFFFE | Slot 1 page | The ROM page seen at 0x4000–0x7FFF. |
0xFFFF | Slot 2 page | The ROM page seen at 0x8000–0xBFFF when RAM is not mapped there. |
First kilobyte. 0x0000–0x03FF is never remapped, so it always shows the start of
page 0 and the interrupt vectors stay in place; slot 0’s register applies to 0x0400–0x3FFF
(it shows the last 15 KB of the chosen page).
Bank shift. Bits 1–0 of 0xFFFC add an offset to every page number written to
0xFFFD–0xFFFF: 00 adds 0, 01 adds 0x18, 10 adds 0x10, 11 adds
0x08. It takes effect only when a page register is next written, no known software uses it, and its behaviour
with ROMs other than 512 KB is undefined.
Width and reset. The register is 3 bits wide on 128 KB cartridges, 5 on 512 KB and 6 on 1 MB. SMS Power says
the reset state is undefined for some chips, and gives the 315-5235’s as 0xFFFC = 0, 0xFFFD = 0,
0xFFFE = 1, 0xFFFF = 2. The explorer’s code view starts from pages 0, 1 and 2 (JSSMS does the same, wrapping the
number by the page count).
Codemasters mapper
Registers at 0x0000 (slot 0), 0x4000 (slot 1) and 0x8000 (slot 2); each answers a
write anywhere in its own 16 KB slot. Nothing protects the first kilobyte, so the page in slot 0 replaces the interrupt
vectors too, and a program has to switch it carefully. The start state is pages 0, 1 and 0 in slots 0, 1 and 2. Writes are not
mirrored in RAM, so the last value cannot be read back. Ernie Els Golf has 8 KB of cartridge RAM: writing a byte with bit 7 set to
0x4000 maps the upper 8 KB of slot 2 (0xA000–0xBFFF) to it.
Korean mapper
Slots 0 and 1 are fixed to pages 0 and 1, and slot 2 (0x8000–0xBFFF) is chosen by a write to
0xA000. SMS Power’s example is Run! Dodgeball King.
Other mappers
Described by SMS Power but not modelled by the explorer, which offers the three above:
- MSX and Nemesis mappers. 8 KB pages, with registers at
0x0000(maps0x8000–0x9FFF),0x0001(0xA000–0xBFFF),0x0002(0x4000–0x5FFF) and0x0003(0x6000–0x7FFF). On the MSX variant the first 16 KB is fixed; on the Nemesis variant (only Nemesis uses it) the last 8 KB page is fixed at0x0000–0x1FFFand the second to last at0x2000–0x3FFF. - Janggun mapper (Janggun-ui Adeul, Korea). 8 KB registers at
0x4000,0x6000,0x8000and0xA000, and 16 KB registers at0xFFFE(0x4000–0x7FFF) and0xFFFF(0x8000–0xBFFF); bits 0–5 choose the page and bit 6 reverses the bit order of reads.
What the explorer shows
The code view lists the three slots: for the Sega mapper the fixed first kilobyte and then slots 0, 1 and 2 with the pages
chosen in the options bar (with page 0 in slot 0 the first two are one block); for the Codemasters mapper the three pages
whole; for the Korean mapper pages 0 and 1 and the chosen page. It does not follow the program to see which pages it maps. In
the disassembly the Sega mapper’s four registers are named MAP_CTRL, MAP_SLOT0, MAP_SLOT1 and
MAP_SLOT2; the other mappers’ registers are ordinary addresses and are not named.
Compared with JSSMS (emulators.org), whose z80.js was run in a test beside this reader: the same page appears at
the same address for any three page numbers written to 0xFFFD–0xFFFF, the first kilobyte stays on page 0, the
registers read back, and the start state is pages 0, 1 and 2. JSSMS implements only the Sega mapper.
Sources
- Mappers – SMS Power
- Memory Map – SMS Power: the registers sit in the RAM mirror
Not described
Cartridge RAM size and battery, which the header does not give, and the mappers of the Korean and other unlicensed cartridges that SMS Power does not list on this page. Only the Sega mapper’s page registers are checked against a running emulator; the Codemasters and Korean mappers are given as SMS Power writes them.