# The MAME recipe (run 2026-11-26, MAME 0.285) MAME is a closed box here: run, never read. The Dreamcast driver files carry `license:LGPL-2.1+` (`sega/dc.cpp`, `dccons.cpp`, `dc_g2if.cpp`), most device files `license:BSD-3-Clause` (sources.md lists them; only the header lines were read). Tier 5: a detector. MAME marks `dc`, `dcjp`, `dceu`, `dcdev` and `dctream` "preliminary" for emulation, and save states unsupported. ## Devices (`mame -listdevices dc`) `maincpu` Hitachi SH7091 @ 200.00 MHz; `soundcpu` ARM7 (little) @ 2.82 MHz; `aica` Yamaha AICA @ 22.57 MHz; `aicartc` AICA RTC @ 32.76 kHz; `powervr2`; `sb_g2if` Sega Dreamcast G2 I/F System Bus @ 25.00 MHz; `screen` @ 26.91 MHz; `ata` with `gdrom` (GD-ROM, `cdda` @ 44.10 kHz, `image`) on connector 0 and an empty connector 1; `maple_dc` with `dcctrl0`-`3`; `dcflash` Fujitsu MBM29LV002TC Flash. The VMU is a separate driver, `svmu` (Sanyo LC8670 @ 32.76 kHz, Atmel 29C010 flash, a quickload slot). ## Romsets `dc.zip` (USA), `dcjp.zip`, `dceu.zip`, `dcdev.zip`, `dctream.zip`, `svmu.zip` under `$MAME_ROMPATH`; census.md lists every image by SHA-1. `dcprt` is named by MAME but absent from the local set (not needed). ## Commands ```sh python -I scripts/mame_run.py --snap 300,600,1200 --frames 1200 # pictures, ~30 s wall python -I scripts/mame_run.py --trace 600 --frames 603 --cpu sound # the ARM7, 3 frames, ~47 s python -I scripts/mame_run.py --trace 1000 --frames 1003 # the SH-4 (or sh4-python's mame_trace.py) ``` What the script passes: `-rompath $MAME_ROMPATH -homepath -snapshot_directory /snap -cfg_directory /cfg -nvram_directory /nvram -video none -sound none -nothrottle -noreadconfig -skip_gameinfo -log -seconds_to_run N -autoboot_script run.lua`, plus `-nodrc -debug -debugger none` when tracing. The Lua script counts frames with `emu.add_machine_frame_notifier`, takes `manager.machine.video:snapshot()` at the listed frames, starts `trace S.trace,,noloop,{logerror "S %X ... %d\n",,totalcycles}` at the trace frame and calls `manager.machine:exit()` at the last. ## What ran | Run | Result | | --- | --- | | `--snap 300,600,1200 --frames 1200` (no disc, empty NVRAM and flash state) | frame 300: the boot ROM's swirl background, no dialog; frames 600 and 1200: the **Set Date/Time** dialog ("11/27/1998 00:00"). MAME reported 67 % of real speed with its SH-4 recompiler on this loaded machine (49.7 % in an earlier identical run) | | `--trace 0 --frames 3 --cpu sound` | **0 ARM7 instructions** in the first 3 frames: the boot ROM holds the ARM in reset that long | | `--trace 600 --frames 603 --cpu sound` | **62,301 ARM7 instructions in 141,258 cycles** (3 frames; 2.27 cycles each by MAME's count, 1.25 M instructions a second), 483 distinct PCs: the boot ROM's sound driver running | | SH-4 windows | in sh4-python docs/mame-oracle.md: 2.61 M instructions a frame at 1.281 cycles each in the menu, 90 % in a 20-PC wait loop | ## What it can decide, and what not - **Can**: the boot ROM's instruction streams (SH-4 and ARM7) for lockstep from reset; the order and values of the boot ROM's register writes (MAME's log names unmapped writes: PVR registers 005F80B0 and 005F8138, the G2 interface's protection ranges "g2apro set top=0ff00000 bottom=080fffff" and "top=0c000000 bottom=0cffffff"); a picture to compare the board's against, pixel differences triaged, never "fixed to match". - **Cannot**: anything about the hardware's timing (MAME's cycle counts are its own); the renderer's exact arithmetic (MAME's is its own); sound output accuracy. ## Traps - The ARM7's PC symbol is `curpc`; `pc` printed 0 for every line (the first ARM run was moved to `trash/` and rerun). - `-nodrc` is needed when tracing the SH-4; tracing a frame writes ~130 MB. - The ALSA "Permission denied" line in stdout is harmless (`-sound none`). - With an empty NVRAM and default flash the boot ROM goes to Set Date/Time and waits; a disc boot needs a clock set first (or an NVRAM from a previous run, kept in `reference/mame/*/nvram`, never committed).