# MAME as a detector for the board (closed box, tier 5) MAME 0.285, machines `psj` / `psu` / `pse` / `psa` (`sony/psx.cpp`, GPL-2.0+ by its `license:` line; the device files for the CPU-chip peripherals, GPU, SPU, CD and the controller port say BSD-3-Clause - per-file list in r3000a-python docs/mame-oracle.md). Closed box: run, never read. Its device tree (OBSERVED, `-listxml psu`): `maincpu` (CXD8530CQ, 67,737,600 Hz) with children `irq`, `dma`, `mdec`, `rcnt`, `sio0`, `sio1`, `ram`; `gpu` (CXD8561Q); `spu` (33,868,800 Hz); `psxcd` (`psx_cd`, firmware region `cdrom_mcu` but no CPU listed); psu only: `subcpu` HD63705Z0 at 4,166,667 Hz; `controllers`, `port1`/`port2` each with `card` and `digital_pad`; `parallel`; `quickload`. ## The recipe (run 2026-11-25) ```sh export MAME_ROMPATH=";" python -I scripts/mame_run.py --frames 600 # WRITES 79883 -> tests/mame_traces/io.log # screenshot tests/mame_traces/snap/psu/0000.png ``` `scripts/mame_run.py` writes `tests/mame_traces/run.lua` and runs, in that directory, ``` nice mame psu -bios 2.2a -rompath "$MAME_ROMPATH" -video none -sound none -nothrottle \ -noreadconfig -skip_gameinfo -snapshot_directory snap -autoboot_script run.lua \ -seconds_to_run N [-quik program.exe] ``` The Lua installs `space:install_write_tap(0x1f801000, 0x1f802fff, "io", fn)` on `:maincpu`'s program space (tap and frame notifier held in globals), logs `time W address data mask`, and after `--frames` frames takes `manager.machine.video:snapshot()` and exits. The CPU instruction trace is r3000a-python's `scripts/mame_trace.py`. What the 600-frame run showed (OBSERVED, MAME's model, SCPH-1001 v2.2a, no disc): - The first five writes are the memory-control set-up at 0.177 us, 0.413 us, 2.0 us...: 1F801010h=0013243Fh, 1F801060h=00000B88h, 1F801020h=00031125h, 1F801000h=1F000000h, 1F801004h=1F802000h (matching psx-spx's boot listing and DRAM_CTRL value). - 79,883 I/O writes in 10 s: SPU data FIFO 1F801DA8h 56,069 (the BIOS clears sound RAM by hand), I_STAT 4,690, SIO0 mode/data 3,862 + 2,410 (pad polling), GP1 3,358, GP0 1,996, DPCR 1,150, DMA2 CHCR 784. - After 10 emulated seconds the shell's main menu (MEMORY CARD / CD PLAYER) is on screen. So a BIOS boot to the shell is about **10 emulated seconds** (in MAME's timing model), the figure domains.md uses for the Python reference's cost. A quickloaded PeterLemon `CPUMULT.exe` shows all PASS after 300 frames (r3000a-python mame-oracle.md). ## What MAME can and cannot decide Can: find differences in I/O write streams, DMA set-ups, interrupt acknowledges and final pictures over seconds of BIOS or test-EXE execution. Cannot: judge timing (its CPU charges ~2 cycles per instruction everywhere: r3000a-python mame-oracle.md), GPU pixel exactness, SPU output or CD timing. Every MAME disagreement is a question, never a verdict.