Platform:Sega Master System
| Developer | Sega |
|---|---|
| Versions | Sega Mark III (1985), Master System (1986), Master System II (1990) |
| Endianness | little |
| Website | https://www.smspower.org/ |
| On this wiki | Facts · Code · Notes · Topics |
Sega's 8-bit console (Mark III 1985 JP, Master System 1986 NA/EU): a Zilog Z80A at about 3.58 MHz, the TMS9918-derived VDP with 16 KiB VRAM, an SN76489 PSG and 8 KiB RAM, with a Sega mapper whose registers are written at 0xFFFC-0xFFFF.
Overview
- CPU: Zilog Z80 (little endian), about 3.58 MHz on NTSC consoles. Mesen2 models it as a Z80 core (
Core/SMS/SmsCpu.cpp). - Video: VDP derived from the TMS9918 with 16 KiB of VRAM, driven through I/O ports; sound: SN76489 PSG (plus a YM2413 FM chip on the Japanese Mark III / Master System).
- Memory: 8 KiB work RAM at 0xC000-0xDFFF, mirrored at 0xE000-0xFFFF. The mapper registers live in the mirror at 0xFFFC-0xFFFF, so a write there both reaches the mapper and the RAM.
- Cartridge: ROM is visible from 0x0000-0xBFFF in three 16 KiB slots; ROM dumps are described on Format:Sega Master System ROM image. The Game Gear is the same architecture: Platform:Sega Game Gear.
Memory map
| Z80 range | Contents |
|---|---|
| 0x0000-0x03FF | ROM, always bank 0 (first 1 KiB is not switched) |
| 0x0000-0x3FFF | slot 0, ROM page chosen by 0xFFFD |
| 0x4000-0x7FFF | slot 1, ROM page chosen by 0xFFFE |
| 0x8000-0xBFFF | slot 2, ROM page chosen by 0xFFFF, or cartridge RAM |
| 0xC000-0xDFFF | work RAM (8 KiB) |
| 0xE000-0xFFFF | mirror of work RAM; 0xFFFC-0xFFFF also mapper registers |
Mappers
The standard Sega mapper (used by ROMs over 48 KiB): writing to 0xFFFD, 0xFFFE or 0xFFFF sets the 16 KiB ROM page of slot 0, 1 or 2; 0xFFFC is a control byte (bit 3 maps cartridge RAM into slot 2, bit 4 maps cartridge RAM at 0xC000, bit 2 selects the RAM bank, bit 7 allows ROM writes, bits 1-0 bank shift) per Mesen2's SmsSegaCart.h. Mesen2 treats bit 4 and bank shift as listed there; the shift is stored but unused by that emulator. Other mappers recognised by Mesen2 by CRC32 or header: Codemasters (checksum pair at 0x7FE6/0x7FE8; page registers at 0x0000, 0x4000, 0x8000), the MSX-style Korean carts, the Nemesis cart and other Korean mappers (Core/SMS/Carts, SmsConsole::InitCart). Genesis Plus GX implements the same register range as write_mapper_sega and several more (core/cart_hw/sms_cart.c).
Recovery notes
- A listing of Z80 code that writes
ld (0xFFFF),a(32 FF FF) or0xFFFE/0xFFFDis a bank switch: the value written is a 16 KiB page, file offset = page * 0x4000 + (address & 0x3FFF). - I/O ports are decoded by the low bits, not by the full address: Genesis Plus GX switches on
port & 0xC1(core/memz80.c, commit 49c5847648). 0xBE/0xBF (pattern 0x80/0x81) are the VDP data and control ports (vdp_z80_data_w,vdp_sms_ctrl_w); 0x7E/0x7F (0x40/0x41) are the PSG on writes (psg_write) and the VDP V counter / H counter on reads (vdp_hvc_r); 0xDC/0xDD and 0xC0/0xC1 read the controllers (io_z80_read(port & 1)); 0x3E/0x3F write the I/O control registers; with FM enabled, 0xF0 and up reach the YM2413.
Related
Platform:Sega Game Gear, Platform:Sega Mega Drive (Z80 and SN76489 as sound hardware), Platform:Game Boy (another Z80-family handheld rival), Platform:Nintendo Entertainment System.
Code & repositories
- https://github.com/SourMesen/Mesen2 @
b9fa69ddc6d0a331fb103fdb5eef6904305703c2· license: GPL-3.0 (declared by the contributor; GitHub's detector did not recognize LICENSE)
Multi-system emulator with debugger; Core/SMS (Sega mapper, Codemasters), Core/PCE (MPR banking, SF2 mapper, CD-ROM), Core/WS (cart footer parsing)
Tested on: source read, not run: read the source, not built · checked 2026-10-18 - https://github.com/ekeeke/Genesis-Plus-GX @
49c584764893b0505ac7f768a754f97330fa4392· license: NOASSERTION (declared by the contributor for the files used; GitHub reports Zlib (read from LICENSE.txt; GitHub's API was busy) for the repository)
Genesis Plus GX: core/cart_hw/sms_cart.c implements the Sega mapper and many variants (Codemasters, Korean, EEPROM)
Tested on: source read, not run: read the source, not built · checked 2026-10-18