# The memory map The SH-4's 29-bit physical space as the Dreamcast wires it. The CPU's own areas (P0-P4, the P4 registers, area 7) are in sh4-python's start-here.md. ## The eight areas (Comstedt *memory*) | Physical | Area | Contents (Comstedt) | | --- | --- | --- | | 00000000-03FFFFFF | 0 | boot ROM (2 MB), flash, hardware registers (Holly, AICA over G2, expansion) | | 04000000-07FFFFFF | 1 | video RAM, 8 MB | | 08000000-0BFFFFFF | 2 | (unused in Comstedt's table) | | 0C000000-0FFFFFFF | 3 | system RAM, 16 MB | | 10000000-13FFFFFF | 4 | tile accelerator command input | | 14000000-17FFFFFF | 5 | expansion (modem) port | | 18000000-1BFFFFFF | 6 | (unused) | | 1C000000-1FFFFFFF | 7 | the SH-4's internal registers (same as P4) | Mirrors inside each area (16 MB RAM in a 64 MB area; 8 MB VRAM in a 64 MB area) are not described by Comstedt: U1 in the brief (MAME's mirroring is a detector). ## Area 0 in detail (KOS addresses, P2 view A0xxxxxx shown as physical) | Physical | Device | Source | | --- | --- | --- | | 00000000-001FFFFF | boot ROM, 2 MB | Comstedt *memory*; MAME's images are 2,097,152 bytes | | 00200000-0021FFFF | flash, 128 KB images (partitions: system 8 K, reserved 8 K, block 16 K, settings 32 K, block 64 K) | KOS `flashrom.h`; MAME's flash images are 131,072 bytes | | 005F6800- | Holly system block: PVR (channel 2) DMA registers at 005F6800 | KOS `pvr_dma.c` ("PVR Dma registers - Offset by 0xA05F6800") | | 005F6900-005F693F | Holly interrupt controller: status A/B/C at 6900/6904/6908, IRQ13 (IRQD) masks at 6910-6918, IRQ11 (IRQB) at 6920-6928, IRQ9 at 6930-6938 | KOS `asic.h` | | 005F6C00- | Maple controller (DMA address, enable, reset, speed) | KOS `maple.h` (`MAPLE_BASE`) | | 005F7000- | G1 ATA: the GD-ROM's ATA registers (alternate status/control at 7018, data at 7080, error/features at 7084, ...) | KOS `g1ata.c` | | 005F7400- | G1 bus control: the GD-ROM DMA, the ATA bus protection (74E4, status 74EC), DMA protection (74B8) | KOS `g1ata.h` | | 005F7800- | G2 bus control: four G2 DMA channels (0: AICA, 1: BBA, 2, 3), suspend registers 781C/783C/785C | KOS `g2bus.h`, `g2dma.c` | | 005F8000-005F9FFF | PVR2 core and display registers; fog table at +0200, palette at +1000 | KOS `pvr_regs.h`; Comstedt *pvr* | | 00600000- | modem / expansion (G2) | Comstedt *hw* (modem); address U2 | | 00700000- | AICA registers (channels at +0x80 per channel; ARM reset at 00702C00) | KOS `spu.c`, `sound/` (`SNDREGADDR`, `0xa0702c00`) | | 00710000-00710007 | AICA RTC (two 32-bit halves of the seconds counter) | KOS `rtc.c` | | 00800000-009FFFFF | sound RAM, 2 MB (KOS also names an 8 MB size for development hardware) | KOS `spu.h` | | 01000000- | G2 expansion | (to confirm: U2) | ## Area 1: video RAM (Comstedt *pvr*) 8 MB as two banks of 4 MB. Two views: a **64-bit** interface at 04000000 (consecutive 32-bit words alternate between the banks) and a **32-bit** interface at 05000000 (bank 1 then bank 2 in sequence). Byte 04000000-03 is 05000000-03; 04000004-07 is 05400000-03; and so on. 8-bit writes are not possible on either; reads of any width are. Textures are read through the 64-bit view, the frame buffer through the 32-bit view. ## Area 4: the TA's inputs (KOS `pvr_regs.h`) 10000000 polygon and vertex parameters (the TA FIFO, 64-bit); 10800000 the YUV converter; 11000000 direct texture writes through the TA path (64-bit view), 13000000 (32-bit view). These are written by the SH-4's store queues and by Holly's channel-2 DMA (holly-pvr2.md). ## Contradictions - C1. Flash size: Comstedt *memory* says "Flash ROM (256K)"; MAME's flash images are 131,072 bytes (128 KB) and KOS's partitions sum to 128 KB; MAME's flash device is a Fujitsu MBM29LV002TC, a 2-Mbit (256 KB) part. Likely "256K" is a 256 KB window or chip holding a 128 KB image (HYPOTHESIS); the board models 128 KB, the window as MAME's detector shows.