# The MAME recipe (run 2026-11-26, MAME 0.285) MAME is a closed box here: the installed binary is run, its source is not opened. Its SAM Coupé driver `samcoupe/samcoupe.cpp` and the drive bus `bus/samcoupe/drive/*.cpp` are GPL-2.0+ by their `license:` lines (sources.md); the SAA1099 (`sound/saa1099.cpp`) and the WD FDC (`machine/wd_fdc.cpp`) are BSD-3-Clause, but are not read either (open decision 6). Tier 5: a detector, never a judge. ## Devices (`mame -listdevices samcoupe`, `-listxml samcoupe`) | Device | MAME's model | | --- | --- | | maincpu | Zilog Z80 @ 6.00 MHz | | screen | 12.00 MHz pixel clock, htotal 768, vtotal 312, visible 576 x 275, 50.080128 Hz | | saa1099 | Philips SAA1099 @ 8.00 MHz | | drive1, drive2 | `samcoupe_drive_port` with `sam_floppy`: one Western Digital WD1772 @ 8.00 MHz and one 3.5" DD drive each | | others | mouse port, cassette, expansion slot (131 slot options listed), software lists `samcoupe_flop` (29 entries) and `samcoupe_cass` (2), both CC0-1.0 | BIOS options: 31 (default), 30, 25, 24, 21, 20, 181, 18, 14, 13, 12, 10, 04, 01, atom (firmware.md). All present under `$MAME_ROMPATH`. ## The commands ```sh python -I scripts/mame_trace.py --frames 300 --trace 3 # ROM 3.1, OUT log, 3-frame Z80 trace, PNG python -I scripts/mame_trace.py --bios 30 --frames 300 # ROM 3.0 ``` The script runs `mame samcoupe -bios N -rompath $MAME_ROMPATH -homepath -video none -sound none -nothrottle -noreadconfig -skip_gameinfo -log -seconds_to_run N -autoboot_script run.lua`, plus `-debug -debugger none` with `--trace`. The Lua installs a write tap on the Z80's `io` space (held in a global) that writes `O port value frame seconds` to `outs.log`; with `--trace` it issues `trace T.trace,:maincpu,noloop,{logerror "T %X %d\n",pc,totalcycles}` and stops tracing after N frame notifications. ## What the run showed (OBSERVED; 1.75 s of wall time, under `nice` on CPUs 24-31) ROM 3.1, about 6 emulated seconds (the frame notifier counts host updates under `-video none`, as the Spectrum recipe found; the run stopped on `-seconds_to_run`): - The picture: the CLUT colour bars and "MILES GORDON TECHNOLOGY PLC (c) 1990 SAM Coupé 512K". - 24,246 OUTs: LMPR (FA) 14,797 (`5FFA` 10,378 and `1FFA` 4,419: values 5F and 1F, the RAM test paging RAM into section A, value on the high byte as for `OUT (n),A`); CLUT (F8, high byte = entry) 6,016; LINE register (F9) 3,179 with the high byte stepping (FFF9, A5F9, 9AF9, 8FF9, ...: the ROM's port writes use B as a counter); HMPR (FB) 186; SAA1099 data (FF) 64; VMPR (FC) 3 (first `1FFC` = mode 1, page 31, at 2.14 s); BORDER (FE) 1 (`08FE`: MIC bit set, border 0, at 2.21 s). First write at 0.277 s: the ROM's ~55 ms ASIC wait and its memory test come first. - The trace: `T 0 0`, `T 1 4`, ..., 55,296 instructions up to total cycle 359,419 in three frame notifications (3 x 119,808 = 359,424); no IM 1 entry at 0038 in that window (interrupts still disabled during the memory test). Whether MAME applies the SAM's contention and mode 1 slow-down, and with what grid, was not checked; MAME's timing is not used as evidence anywhere in these documents. ## Not run No disk was mounted and no program was run (no emulator runs over a library). Output stays in `reference/mame/samcoupe-/` (git-ignored): `outs.log`, `run.log`, `run.lua`, `stdout.txt`, `snap/`.