# MAME as a source of register streams MAME is tier 5 here: a detector, never a judge. What it gives this core is **input**: the exact sequence and timing of a real sound driver's accesses to the chip, which the core and the die model are then both fed. Its own audio output is not compared with anything at Phase 0. ## The recipe, as run MAME 0.285 on the `PATH`, ROMs from `MAME_ROMPATH`. The Lua script `scripts/mame_ym2610_tap.lua` installs a read and a write tap on the sound CPU's I/O space and logs every access to the chip's four ports. Run from `reference/mame-run/` (ignored), so that `nvram/` and `cfg/` land there: ```text cd reference/mame-run YM2610_TAP_OUT=../../validation/streams/nam1975.tap \ mame nam1975 -rompath "$MAME_ROMPATH" \ -video none -sound none -nothrottle -noreadconfig -skip_gameinfo \ -seconds_to_run 12 -nvram_directory nvram -cfg_directory cfg \ -autoboot_script ../../scripts/mame_ym2610_tap.lua ``` 12 emulated seconds take about 2.5 s of wall time. No `-debug` is needed: the taps are address-space taps, not debugger traces. The tap's format, one line per access: ```text # ym2610 tap: nam1975, cpu :audiocpu, space io, ports 04-07, clock 8000000 Hz W port = A1 A0: 0 address I, 1 data I, 2 address II, 3 data II R ``` `` is `machine.time:as_ticks(8000000)`: the chip's input clock since power-on, as fine as MAME's CPU timing (an access lands at the instruction's time, not at its bus cycle). Values are hexadecimal. The defaults fit the Neo Geo (`:audiocpu`, I/O ports $04-$07 on the low address byte); a Taito board sets `YM2610_TAP_CPU`, `YM2610_TAP_SPACE`, `YM2610_TAP_BASE`, `YM2610_TAP_MASK` and `YM2610_TAP_CLOCK`. Why `nam1975`: one of the 13 Neo Geo parents with its own ADPCM-B ROM, so that the stream exercises all four parts with a separate sample ROM for each bus. ## What it gave `validation/streams/nam1975.tap` (ignored: derived from a ROM), SHA-1 `e01e105473f00c1e63870d991cac1d1ae268e9b3`, 9,652 accesses: | Writes to | Count | | --- | ---: | | FM common ($20-$2F, part I) | 1,324 | | SSG ($00-$0D) | 819 | | FM part II ($30-$B6) | 660 | | FM part I ($30-$B6) | 654 | | ADPCM-B ($10-$1C, part I) | 262 | | ADPCM-A (part II $00-$2D) | 160 | | status reads | 1,894 | Smallest gap from an address write to its data write: 92 clocks; from a data write to the next address write: **242** clocks (C3 in [handoff-brief.md](handoff-brief.md)). Flag control $1C was written 139 times, all to part I (C2). ## Runs are not repeatable past a point On 2026-11-12 the recipe was run three more times (one from the `nvram/` the first run left, two from fresh, empty directories). One fresh run reproduced the first tap exactly (same SHA-1); the other two match it for the first **7,993 accesses** (about 9.8 emulated seconds) and then differ. The MVS machine has a uPD4990A calendar that MAME sets from the host's clock, and a backup RAM in `nvram/`; either can change the game's path. Not chased: a tap is a recorded input, named by its SHA-1, and is replayed from the file, never re-recorded for a comparison. The extra taps were not carried over in the restart. ## How the rungs use it 1. Replay the tap into the die model (`lle2610_probe`'s bus driver, each access at its clock) with the game's ADPCM ROMs served on the two buses, and into the core; compare every sample word (rung 5 in [handoff-brief.md](handoff-brief.md); serving the ROMs needs the model's bus pins, U4). 2. Replay it into ymfm and list where ymfm differs from the model (it is a detector; the differences known so far are C1-C12 in [handoff-brief.md](handoff-brief.md)). 3. Further taps for other drivers: one Taito F2 game (`YM2610_TAP_*` set for its sound CPU), (no YM2610B game: the variant is deferred, see validation.md), and a Neo Geo game known for six-channel ADPCM-A use, to exercise the 12-bit accumulator wrap ([adpcm-a.md](adpcm-a.md)). ## MAME notes - A Lua tap held only in a local is collected and stops firing: keep it in a global (`ym2610_write_tap` and friends). - `-seconds_to_run` ends the run cleanly, so the stop notifier closes the file. - The rules' trace recipe (`-debug -debugger none` with `trace`) is not needed for a port tap and was not used here.