# Memory map, as MAME 0.285 builds it **OBSERVED** unless tagged: the address maps of the running MAME binary for `valkyrie` (C65, ROZ), `sws` (C68, ROZ) and `finallap` (C65, road), printed by `scripts/mame_maps.lua`. MAME names most handlers only "delegate"; every function below without a share or region name is a HYPOTHESIS from its size and neighbours. (MAME's `namcos2.cpp` family, which would name them, is BSD-3-Clause and closed for this Phase 0: decision 1.) ```sh mame valkyrie -rompath "$MAME_ROMPATH" -video none -sound none -nothrottle -noreadconfig \ -skip_gameinfo -seconds_to_run 1 -autoboot_script scripts/mame_maps.lua | grep '^MAP' ``` ## The two 68000s (valkyrie; the slave's map is the same except where noted) | Range | Kind | Function | | --- | --- | --- | | $000000-$03FFFF | ROM | the CPU's own program ROM (`:maincpu` / `:slave` region) | | $100000-$10FFFF | RAM | work RAM (the slave's runs to $13FFFF) | | $180000-$183FFF | handler (main only) | HYPOTHESIS: EEPROM / NVRAM | | $1C4000-$1E7FFF | sixteen 8 KB handlers | HYPOTHESIS: the C148 (interrupt levels, acknowledges, CPU control: slave reset, sound reset, MCU reset) | | $200000-$3FFFFF | ROM `data_rom` | game data ROMs, shared by both CPUs | | $400000-$40FFFF (mirror $10000) | handler | HYPOTHESIS: C123 tilemap RAM | | $420000-$42003F | handler | HYPOTHESIS: C123 control (scroll) | | $440000-$44FFFF | handler | HYPOTHESIS: C116 palette | | $460000-$460FFF (mirror $F000) | handler | the **dual-port RAM** shared with the sound 6809 (its `dpram` at $7000-$77FF, 2 KB as bytes on the 16-bit bus) and the MCU ($5000-$57FF) | | $480000-$483FFF | handler | HYPOTHESIS: the C139's shared RAM (`:sci` space, 16 KB) | | $4A0000-$4A0003 | handler | HYPOTHESIS: C139 registers | | $C00000-$C03FFF | RAM `spriteram` | sprite list | | $C40000-$C40001 | handler | sprite control | | $C80000-$C9FFFF | RAM `rozram` | ROZ plane | | $CC0000-$CC000F | RAM `rozctrl` | ROZ parameters | | $D00000-$D0000F | handler | HYPOTHESIS: the protection key custom (as on System 1) | | CPU space $FFFFF3-$FFFFFF | handlers | the 68000 interrupt-acknowledge cycles (vector fetch) | **Final Lap** differs (the road board): sprites at $800000-$80FFFF (`spriteram`), sprite control $840000, road RAM and registers at $880000-$89FFFF, $8C0000, and a read handler at $300000-$33FFFF; no ROZ. `sws` (C68) has the same 68000 map as `valkyrie`. So the video side of the map is per game: the board needs a per-set video configuration. ## Sound 6809 | Range | Kind | Function | | --- | --- | --- | | $0000-$3FFF | bank `audiobank` | banked sound ROM | | $4000-$4001 | handler | YM2151 | | $5000-$51FF (mirror $E00) | handler | C140 registers | | $6000-$61FF (mirror $E00) | handler | HYPOTHESIS: the C140 again (a second window) | | $7000-$77FF (mirror $800) | `dpram` | the dual-port RAM | | $8000-$9FFF | RAM | | | $A000-$BFFF, $C000-$C001, $D001, $E000 | writes | HYPOTHESIS: bank select, interrupt acknowledge, watchdog | | $D000-$FFFF | ROM | | ## MCU: C65 (HD63705Z0) and C68 (M37450) | Range | C65 | C68 | | --- | --- | --- | | internal | RAM $0040-$01BF (384 B); ROM $01C0-$1FFF (`sys2mcpu.bin`, 8 KB image) | registers at $D6-$DD, $E2-$E3, $FC-$FF; RAM $0100-$01FF | | $2000 | read handler | read handler | | $3000-$3003 | read handlers (HYPOTHESIS: DIP switches, inputs) | same | | $5000-$57FF | **the dual-port RAM** | same | | $6000-$6FFF | read nop | read handler | | $8000-$FFFF | external ROM (`c65mcu:external`: `sys2c65b`, `sys2c65c`, or a game's own) | ROM `mcu` (`c68.bin`, 32 KB) | The HD63705**V0** in Hitachi's U08 handbook has 4 KB ROM and 192 B RAM; MAME's Z0 map shows 384 B RAM and an 8 KB internal image: the Z0 is a larger part than the handbook documents (U4 in the brief). ## Channels The **dual-port RAM** joins the 68000s, the sound 6809 and the MCU (three sides, like System 1's triram); the C139 RAM joins the board to a linked cabinet; the C148 lines carry resets and interrupts. [domains-and-speed.md](domains-and-speed.md).