# Memory map, buses and sockets ## The SH-2 view (cache-through addresses add 0x20000000) Two sources agree on the layout: Sega's SCU manual figure 1.3 (DOC: SCU 1.2, the documented regions) and MacDonald's map (DOC: CMH "SH-2 Memory Map", tested on two consoles, including what unmapped regions return). Where only CMH speaks it is marked. | Range (cached view) | Region | Size | Notes | | --- | --- | --- | --- | | 00000000-000FFFFF | Boot ROM | 512 KB, mirrored every 512 KB | CMH | | 00100000-0017FFFF | SMPC registers | 128 bytes, mirrored | byte access, odd addresses (DOC: SMPC 3.x) | | 00180000-001FFFFF | Backup RAM | 64 KB window: 32 KB on odd bytes, even bytes read 0xFF | CMH note 1 | | 00200000-002FFFFF | Work RAM-L | 1 MB DRAM | SCU-DMA may not use it (DOC: SCUF No. 04) | | 00300000-00FFFFFF | open bus with fixed or random patterns | | CMH: three different patterns by range | | 01000000-017FFFFF | SINIT: a 16-bit write raises the **slave**'s FRT input capture | write only | DOC: DUAL 1.2 (address 21000000H); CMH note 4 | | 01800000-01FFFFFF | MINIT: the same for the **master** | write only | DOC: DUAL 1.2 (21800000H) | | 02000000-03FFFFFF | A-bus CS0 (cartridge) | 32 MB | DOC: SCU 1.2 | | 04000000-04FFFFFF | A-bus CS1 (cartridge) | 16 MB | DOC: SCU 1.2 | | 05000000-057FFFFF | A-bus dummy | 8 MB | | | 05800000-058FFFFF | A-bus CS2: the CD block | 1 MB | registers in 64-byte units, mirrored (CMH note 2) | | 05A00000-05AFFFFF | sound RAM (B-bus) | 512 KB | MEM4MB = 0 mirrors 256 KB four times (CMH note 9) | | 05B00000-05BFFFFF | SCSP registers (B-bus) | 4 KB, mirrored (CMH) | 05B00EE4 is the documented end (DOC: SCU fig. 1.3) | | 05C00000-05C7FFFF | VDP1 VRAM | 512 KB | | | 05C80000-05CFFFFF | VDP1 frame buffer (the drawing one) | 256 KB, mirrored | CMH note 7 | | 05D00000-05D7FFFF | VDP1 registers | 24 bytes documented | word writes only (DOC: SCUF No. 03) | | 05E00000-05EFFFFF | VDP2 VRAM | 512 KB, mirrored | | | 05F00000-05F7FFFF | VDP2 colour RAM | 4 KB, mirrored every 4 KB | byte writes corrupt the other byte (CMH note 8) | | 05F80000-05FBFFFF | VDP2 registers | 288 bytes documented, mirrored every 512 | | | 05FE0000-05FEFFFF | SCU registers | 208 bytes documented, mirrored every 256 | must use the cache-through address (DOC: SCUF No. 05) | | 06000000-07FFFFFF | Work RAM-H | 1 MB SDRAM, mirrored every 1 MB | the only work RAM SCU-DMA may use | Above 27 bits the SH7604's own space applies: A31-A29 select cache, cache-through, associative purge, cache address and data arrays, and the on-chip registers (DOC: HM in sh2-python; CMH lists what the Saturn returns in each, e.g. the purge area reads 0x2312). That is the core's business, not the board's: sh2-python models it. Regions MacDonald found to lock the console when read (05900000-059FFFFF, 05D80000-05DFFFFF) need a board decision: model as a lockup (a stall that never ends) or as open bus with a warning. Recommendation: stall the accessing CPU and log, so a game that does it shows up at once (HYPOTHESIS: real units hang; CMH reports a lockup, not why). ## The 68EC000's view Sound RAM at 0x000000 (512 KB), SCSP registers at 0x100000 (DOC: SCSP ch. 3, memory map). The SH-2 sees the same RAM at 05A00000: this shared RAM is the main channel into the sound domain ([domains-and-speed.md](domains-and-speed.md)). ## The CD block's view The SH-1's own map (its 64 KB mask ROM, 4 KB on-chip RAM, the YGR019 registers, the 512 KB buffer DRAM, the MPEG card window) is not in any Sega document; Sega documents only the host side (DOC: CDCI). See [cdblock.md](cdblock.md). ## Sockets (the add-on shape) Following megadrive-python's expansion sockets and pcengine-python's docs/sockets.md, the base board should define these from milestone 1, each with a test-only fake: | Socket | Bus | Devices that plug in | | --- | --- | --- | | `CartridgeSlot` | A-bus CS0/CS1 (and its interrupt lines) | backup RAM cartridge, 1 MB / 4 MB extended RAM (DOC: TB#47), ROM carts (KOF95, Ultraman), the Action Replay class, Netlink modem, the dev "data cartridge" (DOC: TB#46) | | `CdBlockPort` | A-bus CS2 + the CD-DA audio line into the SCSP's digital input | the high-level CD block, a low-level SH-1 CD block, or nothing (ST-V) | | `MpegSlot` | the CD block's expansion | the Video CD card (CMH "MPEG card"); later | | `ControlPort` x 2 | SMPC PDR/DDR pins (7 bits each, TH/TR/TL/D3-D0) | digital pad, 3D (analog) pad, multitap, mouse, keyboard, light gun (via EXLE and the VDP2 HV latch) | | `VideoOut`, `AudioOut` | | the host | The ST-V arcade board is the same CPU, SCU, VDP and SCSP design with ROM boards in the cartridge position and no CD block (OBSERVED: MAME's `stvbios` device list holds the same SH-2 pair, SCU with DSP, SCSP and an SMPC, and no CD block). Open decision 2 asks whether ST-V is a machine row or its own board pinning this one.