# Memory maps: what is known, and how No Data East document of these maps is in hand. Three kinds of evidence exist, and each fact below carries its tag: - **JTSLY** (a board trace, tier 3): the decode equations José Tejada wrote on the Sly Spy DE-0322-3 schematic's main sheet, and the parts and nets on the other sheets. - **MRPAL** (fuse maps of real PALs, tier 1 as data, reader unnamed): the Midnight Resistance TB board's six decode PALs, not yet reduced to equations (milestone M1's first task; the fuse maps of `tb-3` and `tb-4` disagree with MAME's dumps: C2). - **OBSERVED** in MAME: where the games write (60-frame watches, [mame-oracle.md](mame-oracle.md)). An address the game writes is a fact about the game's program; what lives there is MAME's model until a board source says so. ## dec0: the 68000 (Robocop and Sly Spy) | Range | Evidence | What | | --- | --- | --- | | 000000-05FFFF | JTSLY: `~CEF = AB[21:17]==00000`, `~CEG = 00001`, `~CED = 00010`, each pair qualified by R/W and the byte strobes (`~OEA = ~LDS`, `~OEF = ~UDS`) | program ROM, three 128 KB pairs on Sly Spy (the `secretag` set's `maincpu` region is 256 KB on Robocop, 512 KB on Midnight Resistance: OBSERVED) | | 180000-180FFF | OBSERVED (Robocop: 2,972 writes in 60 frames) | HYPOTHESIS: the MB8421 dual-port RAM's 68000 side (2 KB, byte-wide on the low or high lane) | | 240000-24DFFF | OBSERVED (Robocop: 12,667 writes; blocks at 240000, 244000-245FFF, 246000, 24A000, 24C000, 24D000) | the BAC06 register and RAM windows (JTCOP: B0 16 KB, B1 4 KB, B2 4 KB). The pattern of 16-write blocks at 240000, 246000, 24C000 fits three chips' control registers, the rest their tile and scroll RAM (HYPOTHESIS) | | 30C000-30C01F | OBSERVED (86 writes); MAME logs writes to 30C01A and 30C01E at reset as unmapped | I/O and control (sound latch, sprite DMA trigger, priority, interrupt acknowledge: HYPOTHESIS; U8) | | 310000-3107FF, 314000-3147FF | OBSERVED (4,560 writes each) | palette, two 2 KB RAMs (JTSLY: two TMM2018 "Palette RAM" feeding resistor ladders; HYPOTHESIS: red/green in one, blue in the other) | | FF8000-FFBFFF | OBSERVED (Robocop's stack starts at FFC000; 196,723 of 211,000 work-RAM writes land in FF8000-FF87FF); JTSLY: two TMM2063 (16 KB) on the main-memory sheet | work RAM | | FFC000-FFC7FF | OBSERVED (2,048 writes, one full pass) | HYPOTHESIS: sprite RAM (JTCOP: 2 KB object RAM plus a 2 KB table buffer, copied by a DMA: JTSLY's `368917K9` on a `DMADB` bus) | JTSLY's other decode lines, as written on the sheet (the meanings of `DEC2`, `L_R` and `MAIN0` are not on the sheet; HYPOTHESIS until the PALs are reduced): ``` ~DEC4 = ~DEC2 && MAINAB[16:14] == 3'b101 ~DEC5 = ~DEC2 && MAINAB[16:14] == 3'b000 && ~L_R ~CS1 = ~DEC2 && MAINAB[16:14] == 3'b001 ~CE_UK = ~DEC2 && MAINAB[16:14] == 3'b111 ~RF16 = ~AS && ~ASl && (AB[21:20] == 2 || (AB[21:20] == 3 && ~MAIN0)) ``` `RF16` selects the upper half of the 4 MB space (the 2xxxxx and 3xxxxx ranges the games write: 240000-24DFFF, 30C000, 310000, 314000), with `MAIN0` gating part of 3xxxxx: consistent with the OBSERVED writes, not yet proven. ## dec0: the other CPUs | CPU | Evidence | Map | | --- | --- | --- | | 65C02 (sound) | OBSERVED: the reset vector leads to 0x8000; the `audiocpu` region is 32 KB | ROM at 8000-FFFF; 2 KB RAM low (JTCOP); YM2203, YM3812, MSM6295 and the sound latch in between (U9) | | HuC6280 (sound, Sly Spy, Midnight Resistance) | OBSERVED: the first PC is E000 (logical); 64 KB `audiocpu` region; JTSLY's sound sheet: `~CS_OPN`, `~CS_OPL`, `~CER` (ROM), `~CEY`, the 2 KB CXK5816 | the HuC6280's MMU maps 21-bit physical space (huc6280-python owns the mapper); the board decodes ROM, RAM, OPN, OPL, OKI and the latch (U9) | | HuC6280 (Robocop's protection) | OBSERVED: first PC FE00; the program is a 512-byte PROM (`sub` region) | the PROM, the MB8421's right port, and the HuC6280's own 8 KB RAM page (U10) | | i8751 | MCS51 (DOC): 4 KB internal EPROM, 128 bytes internal RAM, four 8-bit ports; OBSERVED: the 68000 writes the MCU's ports 1 and 3 (MAME's log) | the protocol between the 68000 and the 8751 (latches on ports 0/1/3 and an interrupt) is U11 | ## The MB8421 (DOC: FSRAM91 p. 4-53 on) 2,048 x 8 dual-port static RAM, two fully independent ports, a BUSY output for a same-address collision and, on the MB8421 only, two interrupt flags used as mailboxes: a write by the right port to address 7FE sets `INTL` (the left port's interrupt); the left port reading 7FE clears it. A write by the left port to 7FF sets `INTR`; the right port reading 7FF clears it. Both flags are inactive (high) at power-up; a port whose BUSY is low cannot set or reset a flag. Which side is the 68000 and which the HuC6280, and where `INTL`/`INTR` go (68000 IPL, HuC6280 IRQ), is U10. ## deco16 (Caveman Ninja; OBSERVED only) | Range | Writes in 60 frames | Reading (HYPOTHESIS) | | --- | ---: | --- | | 000000-0BFFFF | (ROM) | program, 768 KB on `cninja` | | 140000-14FFFF | 18,700 (blocks 140000, 144000-146FFF, 14C000, 14E000) | DECO 55 #1: control registers, two playfields' tile RAM, row/column scroll RAM | | 150000-15FFFF | 18,700 (same pattern) | DECO 55 #2 | | 184000-187FFF | 400,151 in 184800-184FFF of 412,000 | work RAM (SP starts at 188000) | | 190000 | 308 | interrupt controller (`deco_irq` in MAME's device list) | | 19C000-19DFFF | 2,048 | palette | | 1A4000-1A47FF | 1,536 | sprite RAM (DECO 52, buffered) | | 1B0000-1B000D, 1B4000 | 6 each | unmapped in MAME (it logs the six writes at reset): U12 | | 1BC000 | 167 | DECO 104 window (MAME's log names its XOR register and sound latch) | Other deco16 drivers place the same blocks elsewhere; each set's map is read from its PALs (MAME carries `tj-00`...`tj-05` for Caveman Ninja) or observed per set before it gets a machine row.