# Memory map Tags as in [start-here.md](start-here.md). The ranges are MAME's `cps3_map` `[mame]`; the areas, widths and costs are the board's `[board]` (DP tables 2 and 3: effective CPU clocks per access in whole loops, cache on, through the cache-through alias where the access is not a cached hit). ## The SH-2's view Every external address appears in each of the SH7604's partitions `[HM 8]`: `0xxxxxxx` cached, `2xxxxxxx` cache-through, `4xxxxxxx` associative purge, `6xxxxxxx` cache address array, `Cxxxxxxx` cache data array, `Fxxxxxxx` on-chip modules. The games read hardware through the cache-through aliases (`25000000` inputs, `240C000C` DMA status) `[board]`. sh2-python removes the partition bits before calling the board; the table below is in external addresses. | Range | Device | Area, width | Board cost (CPU clocks) | | --- | --- | --- | --- | | `00000000-0007FFFF` | BIOS flash (cartridge), encrypted | CS0, 8-bit | 29 per long read; 112 per cache line | | `02000000-0207FFFF` | work RAM, 512 KiB | CS1, 16-bit | 6.2 word / 10.6 long read; 36 per line; 3.7 / 8.0 write | | `03000000-030003FF` | "FRAM": touched only by the memory test of Red Earth and SFIII, odd bytes only `[mame]` | | probably the cartridge's FM1208S (U21) | | `04000000-0407FFFF` | sprite RAM, 512 KiB: sprite lists, tilemaps, line tables | CS2, 16-bit | 19.5 long write; 21.6 long read | | `04080000-040BFFFF` | colour RAM, 0x20000 words | CS2 | 7.4 word, 15.3 long write | | `040C0000-040C00AF` | PPU and DMA registers ([video.md](video.md)); status read at `040C000C` | CS2 | | | `040E0000-040E02FF` | sound registers ([sound.md](sound.md)) | CS2 | | | `04100000-041FFFFF` | character RAM window, 1 MiB of 8 MiB, bank in `040C0086` | CS2 | 39.5 long write; about 20 per word | | `04200000-043FFFFF` | graphics flash window, 2 MiB chip pair, bank in `040C0088` | CS2 | | | `05000000-05000003` | inputs | CS2 | 5.0 word read | | `05000004-05000007` | extra inputs (kick harness) | | | | `05000008-05000009` | output port (coin counters, lockouts) | | | | `05000A00-05000A1F` | "development DIP switches"; must read all ones or Red Earth crashes before booting `[mame]` | | U18 | | `05001000-05001203` | EEPROM window ([eeprom.md](eeprom.md)) | | | | `05040000-0504FFFF` | SS RAM: 8-bit cells, only odd bytes exist | CS2, 8-bit cells | 17.2 word, 34.9 long write; 19.4 word read | | `05050000-0505002B` | SS registers, odd bytes | | | | `05100000` | write: acknowledge IRQ12 (VBlank) | | | | `05110000` | write: acknowledge IRQ10 (DMA) | | | | `05120000`, `05130000` | write: acknowledge IRQ14, IRQ6; "unused" `[mame]` | | U19 | | `05140000-05140003` | WD33C93: address/status at +1, data at +3 (odd bytes) | | | | `06000000-067FFFFF` | SIMM 1, program flash, encrypted | CS3, 32-bit | 6.0 long read; 20 per line | | `06800000-06FFFFFF` | SIMM 2 | CS3, 32-bit | | | `07FF0048` | written during flash programming, bit 0 toggles `[mame]` | | U20 | | `C0000000-C00003FF` | the SH-2's own cache data array, used as RAM that code runs from | on chip | [sh2-core.md](sh2-core.md) | Bus configuration the BIOS and games program `[board, rom]`: BCR1 = `0020`, BCR2 = `00E8` (CS1 and CS2 16-bit, CS3 32-bit), WCR = `AA57` (two idle cycles after a read in every area, one wait with external WAIT sampling on CS1-CS3, long wait of five states on CS0), MCR = `0000`, CCR = `01` after set-up. CS0's 8-bit width comes from the mode pins. MAME charges one clock for every access. The board's game pass costs about four times MAME's count `[board]`. ## Things that only fail on the board `[board]` - A read beyond the 512 KiB of work RAM never completes: WAIT is held, the CPU sits in the bus cycle, and no interrupt can be taken. Emulators return a value. - SS RAM keeps only its odd bytes. The BIOS memory test masks its readback with `00FF00FF`. - Hardware read through the cached partition can return a stale cache line. ## Interrupts External levels on the IRL pins `[mame, jt]`, taken as auto-vectors (3rd Strike's table: 69 for levels 10-11, 70 for 12-13, 71 for 14-15 `[rom]`); the on-chip timer has its own priority. | Level | Source | Acknowledge | | --- | --- | --- | | 15 | on-chip FRT compare A; the game sets its priority to 15 `[board]` | on chip | | 12 | VBlank | write `05100000` | | 10 | a DMA finished: character, palette `[board]` | write `05110000` | | 14 | no source known; 3rd Strike installs a handler on auto-vector 71 (levels 14-15) that only writes `05120000` `[rom]` (U19) | write `05120000` | | 6 | no source known; no handler in 3rd Strike's table (vector 67 unused) `[rom]` | write `05130000` | `[board]`: IRQ10 is raised once when a DMA completes and never otherwise. In 685 recorded frames, 483 with a character batch took exactly one IRQ10 and 200 without took none. MAME raises it 100 µs after the request (its own comment calls the delay a hack). FinalBurn Neo raises it after a fixed 2,500 clocks for palette DMA, immediately for character DMA, and again on every third of its four slices per frame whether a DMA ran or not `[fbn]`. The game sets OCRA = `3333` with clear-on-compare, FRT at clock/8: period OCRA + 1 = 13,108 ticks, four compares per frame, the fourth a few ticks before the next VBlank. The compare flag survives the handler's counter reset, so in 20-29% of frames the timer handler runs first and delays IRQ10 service by 65 ticks `[board]`. ## Writes nobody maps (seen in this phase's MAME runs) `[ran]` From `error.log` of `redearthnr1` and `sfiii` (2026-11-11): | Address | Values | From | | --- | --- | --- | | `05000A20`, `05000A24` | `0001` | BIOS, repeatedly while waiting at the CD prompt | | `05000C00` | `0000`-`0006` | game code (`06689ABC`), Red Earth | | `05000C10`-`05000C18` | `0000` | BIOS at `00000C40`-`00000C50` | | `05150000` | `4642` | BIOS at `00000C56` | | `07FF000C` | `01050003`, `01050000` | logged with no CPU context | | SS registers `00`-`06`, `09`-`0F`, `13` | the CRTC values of [video.md](video.md) | BIOS | They are U22 in the brief.