# MAME 0.285 as a detector for the Vectrex: the recipe, as run MAME is tier 5: it finds differences, it does not decide them ([validation.md](validation.md)). Everything below was run on this machine (2026-11-11 and 2026-11-12) with `/usr/games/mame` 0.285; the source read is the pinned `mame0285` tree in `reference/src/mame` (`f379cd0`). ## The recipe ```sh python3 scripts/mame_trace.py --seconds 2 # Mine Storm boot, instruction trace + VIA log python3 scripts/mame_trace.py --seconds 6 --no-trace --snap-at 5.5 --name snap python3 scripts/mame_trace.py --cart "$NO_INTRO_DIR/GCE - Vectrex/Berzerk (USA).zip" \ --seconds 14 --no-trace --snap-at 13.5 --name berzerk ``` which runs, in `tests/mame_traces//` (git-ignored): ``` mame vectrex -bios bios0 -rompath "$MAME_ROMPATH" \ -homepath /mame-home -snapshot_directory /snap \ -video none -sound none -nothrottle -noreadconfig -skip_gameinfo -debug -debugger none -log \ -seconds_to_run N -autoboot_script scripts/mame_trace.lua [-cart ] ``` `-bios bios0` is the B796 ROM (`exec_rom.bin`), `bios1` the 7931 one ([executive.md](executive.md)). The cartridge is read in place from the No-Intro zip. Outputs: | File | Content | | --- | --- | | `symbols.txt` | device tags, the CPU's state symbols, the screen, and the cartridge's first 16 bytes (to prove `-cart` loaded) | | `error.log` | with tracing on: one line per instruction, `PC A B X Y U S DP CC totalcycles` | | `via.log` | one line per CPU access to `$D000-$D7FF`: ` R|W ` | | `vectors.log` | one line per read of `$FFF2-$FFFD` (the SWI3..NMI vectors): `
` | | `snap/vectrex/NNNN.png` | a rasterised picture, if `--snap-at` was given | ## Measured facts - **Devices**: `:maincpu` (mc6809, clocked at the 6 MHz crystal and dividing by 4), `:via6522_0` (mos6522), `:ay8912`, `:dac` (mc1408), `:vector`, `:screen` (400x300, 60 Hz nominal), `:cartslot` (`:cartslot:vec_rom` when a cartridge is in), `:cart_list`. - **State symbols** of `:maincpu`: `PC S CC DP A B D X Y U CURPC CURFLAGS`. In debugger expressions the lower-case names and `totalcycles` work. No E-clock or bus-phase symbol. - **Instruction trace**: `trace /dev/null,,noloop,{logerror "...",pc,a,b,x,y,u,s,dp,cc,totalcycles}` (the first attempt with `>>NUL` as the file produced nothing). 2 emulated seconds = **851,253 lines** (38 MB) in about 20 s wall; `totalcycles` is in E cycles (3,024,999 at the end) and is the count **at the start** of the instruction. - **VIA access log**: Lua `install_write_tap` / `install_read_tap` on `$D000-$D7FF`, stamped with `machine.time:as_ticks(1500000)`. MAME times each access **inside** its instruction: the boot's `STD <$02` starting at cycle 2239 writes `DDRB` at 2242 and `DDRA` at 2243; `CLR