# The MAME recipe (run 2026-11-26, MAME 0.285) MAME's binary is run, never built here. Its Model 1/2 files are BSD-3-Clause and pinned for reading (sources.md); running the binary touches nothing of ours. One MAME process at a time, a few emulated seconds, under `nice taskset -c 24-31`. ## Commands, as run ```sh python -I scripts/mame_trace.py --driver vf2 --snap 20 # untraced, PNG after 1,200 frames python -I scripts/mame_trace.py --driver vf2 --frames 2 # the i960, traced ``` The script passes `-rompath $MAME_ROMPATH -homepath -cfg_directory /cfg -nvram_directory /nvram -video none -sound none -nothrottle -noreadconfig -skip_gameinfo -log -seconds_to_run N -autoboot_script run.lua`, and when tracing `-nodrc -debug -debugger none`. The Lua sets `manager.machine.debugger.visible_cpu`, issues `trace T.trace,,noloop,{logerror "T ...\n",,totalcycles}` and exits from a frame notifier after a snapshot. Output: `reference/mame/-/` (git-ignored). | Run | Result | | --- | --- | | `vf2 --snap 20` | 12.95 s wall; MAME reports "Average speed: 192.87% (20 seconds)"; the snapshot shows the attract mode (a fighter on a textured 3D stage, "INSERT COIN(S)", "© SEGA 1994"); 1,147 log lines | | `vf2 --frames 2` (i960) | 606,796 instructions in 910,199 MAME cycles; IP 0xB0 to a wait loop at 0x100; log "Start copro upload"; 21.8 MB; 11.6 s wall | MAME processes started in this phase for Model 2: the two runs above, one earlier trace with the wrong register symbol (below), and one Lua run listing each CPU's state symbols. ## Device tags and debugger symbols (from Lua `device.state`) | CPU | Tag | Symbols | | --- | --- | --- | | i960KB | `:maincpu` | `ip` (instruction pointer), `ac`, **`pc` = process controls**, `fp`, `sp`, `pfp`, `rip`, `g0-g14`, `r3-r15`, `prcb`, `sat` | | MB86234 TGP | `:copro_tgp` | `A B B0 B1 C0 C1 D I0 I1 M MASK P PCS0-3 R RPC SFT SP VSM X0 X1` | | SHARC (2B) | `:copro_adsp` | not listed in this phase | | TGPx4 (2C) | `:copro_tgpx4` | not listed in this phase | | 68000 | `:audiocpu` | `PC SR A0-A6 D0-D7 SP USP` | ## Traps - **The i960's `pc` is not the program counter** (it is Process Controls); use `ip`. The first trace logged a constant 0x1F2002 on every line. - Use non-merged sets (each zip complete): `$MAME_ROMPATH` points at them. - 82 of 89 Model 2 sets are `preliminary` in MAME 0.285: pick a working one (`vf2`, imperfect) for boot traces. - MAME runs the 2O/2A geometrizer as C code (the DSP's ROM is undumped) and the 2B/2C geometrizer DSPs likewise, ignoring their uploaded programs; the copro DSPs are run from their uploaded programs. - MAME's per-instruction cycle constants are its own.