# The MAME recipe (run 2026-11-26, MAME 0.285) MAME is a closed box here: run, never read (its System 24 and System 32 files' licences were checked by their `license:` lines only, [sources.md](sources.md)). It is a tier-5 detector. One MAME process at a time, a few emulated seconds of tracing per run, `nice` and `taskset -c 24-31`. ## Devices (`mame -listdevices`) | Machine | Devices and clocks MAME declares | | --- | --- | | `hotrod` | `maincpu`, `subcpu` MC68000 @ 10 MHz; `tile` System 24 Tilemap; `sprite` System 24 Sprites; `mixer` System 24 Mixer; `io` Sega 315-5296 @ 16 MHz; `ymsnd` YM2151 @ 4 MHz; `dac` 8-bit R-2R; `adc1`, `adc2` MSM6253; `upd1`, `upd2` uPD4701A; `floppy_nvram`; timers `irq_timer`, `irq_timer_clear`, `irq_frc`, `frc_timer`, `scantimer`; `screen` @ 16 MHz | | `radm` | `mainpcb` "Sega System 32 analog PCB": `maincpu` NEC V60 @ 16.10 MHz; `soundcpu` Z80 @ 8.05 MHz; `ym1`, `ym2` YM3438 @ 8.05 MHz; `rfsnd` RF5C68 @ 12.5 MHz; `io_chip` 315-5296 @ 8.05 MHz; `adc` MSM6253; `eeprom` 93C46; `s32comm`; timers `v60_irq0`, `v60_irq1` | | `orunners` | `mainpcb` "Sega Multi 32 analog PCB": NEC V70 @ 20 MHz; Z80 @ 8 MHz; `ymsnd` YM3438 @ 8 MHz; `sega` YMW-258-F @ 10 MHz; `io_chip_0`, `io_chip_1` 315-5296; `screen`, `screen2`; `sleft`, `sright` | ## The commands ```sh python -I scripts/mame_trace.py hotrod --snap 30 # untraced, PNG at frame 1800 python -I scripts/mame_trace.py hotrod --frames 120 # the main 68000 from power-on python -I scripts/mame_trace.py hotrod --frames 3 --cpu sub --after 1500 # the sub 68000 in play python -I scripts/mame_trace.py hotrod --frames 2 --after 1500 --watch 0,1000000 # its writes python -I scripts/mame_trace.py gground --frames 3 --cpu sub --after 1500 # an FD1094 python -I scripts/mame_trace.py radm --frames 60 --cpu v60 # System 32's V60 python -I scripts/mame_trace.py radm --frames 60 --cpu s32sound # its Z80 python -I scripts/mame_trace.py orunners --frames 3 --cpu v60 # Multi 32's V70 python -I scripts/mame_trace.py ga2 --frames 3 --cpu v25 # the V25 ``` Options as in ../system16-python's recipe (`-rompath $MAME_ROMPATH -homepath -cfg_directory -nvram_directory -video none -sound none -nothrottle -noreadconfig -skip_gameinfo -log -seconds_to_run N -autoboot_script run.lua`, `-debug -debugger none` when tracing). New here: `--after N` issues the `trace` and `wpset` commands from the frame notifier at frame N, so a trace can skip the floppy load (about 9-11 s). Register symbols that worked: 68000 `pc,sr,d0,a7`; V60/V70 `pc,sp`; Z80 `pc,af,sp`; V25 `pc`. ## What came out (OBSERVED in MAME; a detector's numbers, not hardware's) | Run | Wall | Result | | --- | ---: | --- | | `hotrod --snap 30` | ~3 s | 1800 frames at 1180% speed; Hot Rod's attract (street scene, 496 x 384) | | `hotrod --frames 3` (main) | | 58,943 instructions in 537,916 cycles (9.1); first PC 0x00040A, SR 0x2700 | | `hotrod --frames 120` (main) | | 2,560,113 instructions in 20,877,190 cycles (8.2) | | `hotrod --frames 3 --cpu sub` and `--frames 120 --cpu sub` | | **no sub-CPU instruction** in the first 120 frames | | `hotrod --frames 3 --cpu sub --after 1500` | 4.8 s | 40,094 instructions in 521,450 cycles (13.0); PCs 0x006012-0x006A7E; the sub's cycle counter reads 171.5 M against the main's 260.8 M: the sub started about 8.9 s after power-on | | `hotrod --frames 3 --after 1500` (main) | | 35,335 instructions in 521,504 cycles (14.8); PCs near 0x0802FA (RAM) | | `hotrod --frames 60 --watch 0,1000000` (main, from power-on) | | writes to 0x080000-0x09FFFF (65,536), 0x800000 (80), 0xFF0000 (84), 0xA00000 (2), one each at 0x240000, 0x260000, 0x270000, 0x400000 | | `hotrod --frames 2 --after 1500 --watch 0,1000000`, main and sub | | main: 0x400000 (2), 0x800000 (10), 0xC00000 (8), 0xD00000 (2), 0xF00000 (6), 0xFF0000 (434); sub: 0x000000 (164), 0x200000 (8), 0x600000 (2), 0xFF0000 (6) (64 KB pages) | | `gground --frames 3 --cpu sub --after 1500` (FD1094) | | 47,938 instructions in 521,452 cycles (10.9); PCs 0x0080A4-0x0085B2; started about 11.1 s after power-on | | `radm --snap 30` | | Rad Mobile's attract ("Credits to start"), 416 x 224 (MAME rates it imperfect, graphics) | | `radm --frames 3 --cpu v60` | | 100,675 instructions in 805,392 cycles; **first PC 0xFFFFFFF0** (V60PRM's reset address) | | `radm --frames 60 --cpu v60` | | 2,013,494 instructions in 16,107,944 cycles: **every instruction exactly 8 cycles** (the delta histogram has one bar) | | `orunners --frames 3 --cpu v60` (V70) | | 125,000 instructions in 999,992 cycles: 8 each again | | `radm --frames 60 --cpu s32sound` | | 781,057 Z80 instructions in 7,922,504 cycles (10.1) | | `ga2 --frames 3 --cpu v25` | | 21,280 V25 instructions in 249,916 cycles (11.7; 5.0 M cycles a second, half the 10 MHz clock) | ## Traps met - Watchpoints issued at start log the whole run even when the trace starts late; `--after` now issues both together (an earlier run without this logged 25 s of writes: discarded). - System 32 devices live under `:mainpcb:` (and `:slavepcb:` on the two-board sets); the defaults use `:mainpcb:`; `--tag` overrides. - MAME logs "EEPROM: Overclocked read by 2 bits" 64 times on `radm` at start and a few unmapped writes (0xC00060, 0xE0000A-E): noise for this recipe, U for the board. - MAME's V60 cycle counts are not timing (above). ## Output `reference/mame/-/` (git-ignored): `run.log`, `stdout.txt`, `run.lua`, `snap//*.png`.