# The MAME recipe (run 2026-11-25, MAME 0.285) MAME is a closed box here: run, never read (its source is GPL-2.0+/BSD-3 mixed; tonight's rule treats all of it as closed). It is a detector, tier 5. ## Devices (`mame -listdevices saturn`) `maincpu` and `slave` Hitachi SH-2 (SH7604) @ 28.63 MHz; `audiocpu` MC68000 @ 11.28 MHz; `scsp` Yamaha YMF292-F SCSP @ 22.57 MHz; `scu` with `scudsp` @ 14.31 MHz; `smpc` "Sega Saturn SMPC HLE (HD404920FS)" @ 4.00 MHz; `saturn_cdb` "Saturn CDB (CD Block)" @ 16.00 MHz with `cdbcpu` "Hitachi SH-1 (SH7032)" @ 16.00 MHz; `stvcd` "Sega Saturn/ST-V CD Block HLE"; `screen` @ 6.71 MHz; cartridge slot `exp`; two `ctrl` ports. The CD block HLE (`stvcd`) is what actually serves commands in the run below (its log lines). Notes from the list: MAME's SH-2s run at 28.63 MHz, the 352-mode figure, even at boot (the PLL starts in 320 mode by the SMPC manual, so this is a MAME simplification: OBSERVED, not checked further); its CD block CPU is 16 MHz against OVW's 20 MHz (C3). ## Romsets `saturn.zip` (and `saturnjp`, `saturneu`, `saturnkr`, `vsaturn`, `hisaturn`) under `$MAME_ROMPATH`: boot ROM images plus `cdb105.bin`, `cdb106.bin`, `ygr022.bin` (census.md). `saturn2.zip` and `saturnzi.zip` are unrelated arcade games that share the name. ## The commands ```sh python -I scripts/mame_trace.py --snap 20 # untraced, PNG at frame 1200 (~1.2 s wall) python -I scripts/mame_trace.py --frames 3 # master SH-2 traced (~11 s wall, 30 MB log) python -I scripts/mame_trace.py --frames 3 --cpu cdb # the CD block's SH-1 (not run tonight) ``` What the script passes: `-rompath $MAME_ROMPATH -homepath -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 script sets `manager.machine.debugger.visible_cpu`, issues `trace S.trace,,noloop,{logerror "S %X %X %X %X %d\n",pc,sr,pr,r15,totalcycles}` and `wpset` watchpoints on the SMPC command register (0010001F) and the SCU block (05FE0000, 0x100 bytes; MAME masks the SH-2's addresses to 27 bits), then a frame notifier saves a snapshot and exits. ## Traps met - `-seconds_to_run` takes whole seconds; stop by frame count from Lua (as sh2-python's recipe does). - With an empty NVRAM the overseas boot ROM shows its language screen first; at frame 300 (5 s) the picture is still black, at frame 1200 the "Set Language" menu is up. - The log fills with "SCSP: Reading from EXTS register" lines (466 in the 5 s run, 2,376 in the 20 s run): the boot ROM's sound driver reading the CD audio input, which MAME's SCSP reports as a read of an unsupported register. Detector noise, not a finding. - `-nodrc` is needed when tracing an SH-2 (sh2-python's mame-oracle.md); 3 frames take about 11 s of wall time on this loaded machine. ## Output `reference/mame/saturn-snap/` and `reference/mame/saturn-master/` (git-ignored): `run.log` (the trace lines and MAME's own log), `snap/saturn/*.png`, `stdout.txt`.