# The MAME recipe (run 2026-11-26, MAME 0.285) MAME is a closed box here: run, never read. Its V810 files (`src/devices/cpu/v810/v810.cpp`, `v810.h`, `v810dasm.cpp`, `v810dasm.h`; Tomasz Slanina, Angelo Salese) carry `license:BSD-3-Clause` lines (read through raw.githubusercontent.com, first lines only, at tag `mame0285`, 2026-11-26), so the family's rules would allow them with notice; tonight's brief keeps them closed (open decision 6). Tier 5: a detector. ## Machines - `vboy`: "NEC V810 @ 20.00 MHz" (`maincpu`), two 10 MHz screens `3dleft`/`3dright`, `vbsnd` @ 5 MHz, a cartridge slot; driver status **preliminary**, save states unsupported (`mame -listxml vboy`). No firmware: the cartridge is the only input. - `pcfx` / `pcfxga`: "NEC V810 @ 21.47 MHz"; BIOS sets v100 and v101 plus `fx-scsi.rom`; status **preliminary** (`mame -listxml pcfx`). The BIOS comes from `$MAME_ROMPATH`. ## Commands ```sh python -I scripts/mame_trace.py --machine pcfx --bios v101 --start 0 --frames 2 \ --out tests/mame_traces/pcfx-boot.trace # 8 s wall python -I scripts/mame_trace.py --machine vboy \ --cart "$NO_INTRO_DIR/Nintendo - Virtual Boy/Mario's Tennis (Japan, USA) (En).zip" \ --start 0 --frames 3 --out tests/mame_traces/vboy-mariotennis.trace # 12 s wall ``` The script passes `-video none -sound none -nothrottle -noreadconfig -skip_gameinfo -debug -debugger none -autoboot_script `; the Lua sets `trace ,maincpu,noloop,{tracelog "PSW=%08X ",PSW}` at frame 0 and stops after N frames from a frame notifier. MAME opens the cartridge from the No-Intro zip directly. ## Symbols and format Accepted register symbols: `PSW`, `R1`..`R31`, `SP` (r3), `EIPC`, `ECR`, `CHCW`, `TKCW`, `PIR` (checked by a 1-frame run). Each trace line is ` : `, MAME's spellings (`LDW`, `STH`, `INH`, `OUTH`, `MOVEA FFFFC090, R5, R5`, `LDSR R1,PSW`). ## What the runs show (OBSERVED, MAME's behaviour) - Both machines start at FFFFFFF0h with PSW = 00008000h and ECR = 0000FFF0h, as ARCH table 9-1 says. - **PIR reads 00000000h and TKCW 00000000h** in MAME. ARCH 2.2.5 gives PIR = 0000810Xh for the family and STS 00005346h for the NVC; ARCH 2.2.6 fixes TKCW's FIT, FZT, FVT bits to 1. A MAME gap, not a hardware fact. - The PC-FX BIOS clears the cache with CHCW = 00010001h (CEC = 256, above 128: ARCH's clamp makes it "clear all"), writes 0, then sets ICE (CHCW = 2), within its first 90,200 instructions: a real program using the documented idiom. - The PC-FX BIOS's first two frames are dominated by NOP (208,003 of 443,321: a delay loop) and ADD/CMP/BLT loops; 18,112 OUT.H writes. Mario's Tennis's first three frames are a WRAM clear (STH, MOVHI, ADD, CMP, BLT ~ 112,000 each). - Instruction rate in MAME's own timing: 443,321 / 0.03343 s = 13.3 M/s (PC-FX, 21.48 MHz) and 639,093 / 0.05995 s = 10.7 M/s (VB, 20 MHz). MAME's cycle counts are not evidence about the hardware (C7); the numbers are used only as an order of magnitude in the speed arithmetic. - The VB frame in MAME is 0.019985 s (50.04 Hz); STS says 50.0 Hz (a 20 ms display frame). Recorded for virtualboy-python. ## Output `tests/mame_traces/` (git-ignored): the traces (14-38 MB each), `cfg/`, `nvram/`, `trace.lua`.