# MAME as a detector (closed box, tier 5) MAME 0.285 (`mame -version`: "0.285 (unknown)"). Its Channel F machines are `channelf` (parent; BIOS sets `sl31253` and `sl90025`, plus `sl31254`), `channlf2`, and the clones `sabavdpl`, `sabavpl2`, `luxorves`, `luxorvec`, `itttelma`, `ingtelma`; source `fairchild/channelf.cpp`. The CPU device is "Fairchild F8" at 1,789,772 Hz on the NTSC machines and 2,000,000 Hz on the PAL Channel F II clones (`mame -listxml`, OBSERVED). **Closed box.** Only the `// license:` lines were read, through the GitHub API at tag `mame0285` (2026-11-26): `src/devices/cpu/f8/f8.cpp`, `f8.h`, `f8dasm.cpp` (Juergen Buchmueller) and `src/devices/machine/f3853.cpp`, `f3853.h` (Wilbert Pol, hap) say **BSD-3-Clause**; the Channel F driver files say GPL-2.0+ (channelf-python docs/mame-oracle.md). The BSD files would be "code OK with notice" by the family's rules; this Phase 0 keeps them closed (Open decision 3 in the brief). ## The recipe (run 2026-11-26) ```sh export MAME_ROMPATH="" # channelf.zip: sl31253, sl31254, sl90025 python -I scripts/mame_trace.py --start 0 --frames 2 --out tests/mame_traces/boot.trace # WINDOW 0.033041 s # 8195 lines traced to .../tests/mame_traces/boot.trace python -I scripts/mame_trace.py --start 60 --frames 60 --regs "" --out tests/mame_traces/idle60.trace # WINDOW 0.991232 s # 211186 lines traced to .../tests/mame_traces/idle60.trace ``` The script writes `tests/mame_traces/trace.lua` and runs, in `tests/mame_traces/` (git-ignored): ``` nice mame channelf -bios sl31253 -rompath "$MAME_ROMPATH" -video none -sound none -nothrottle \ -noreadconfig -skip_gameinfo -debug -debugger none -autoboot_script trace.lua -seconds_to_run N ``` The Lua issues `trace ,maincpu,noloop,{tracelog "A=%02X W=%02X IS=%02X DC0=%04X PC1=%04X ",A,W,IS,DC0,PC1}` before `go` (start 0) or at frame `start`, and `trace off` after `frames` frames, counted with `emu.add_machine_frame_notifier`. Lines look like ``` A=01 W=03 IS=00 DC0=0000 PC1=0000 0006: CI H'40' ``` (registers **before** the instruction, then address and MAME's disassembly). Traces hold disassembled firmware: they stay in the ignored directory and are never committed. MAME's F8 state symbols (probed with a Lua listing of `manager.machine.devices[":maincpu"].state`): `PC0 PC1 DC0 DC1 W A IS R0 R1 R2 R3 R4 R5 R6 R7 R8 J H K Q HU HL KU KL QU QL GENPC CURPC CURFLAGS`. Scratchpad bytes above r15 are not symbols; read them with the debugger's memory commands if needed. ## What was seen - From reset the BIOS (sl31253 + sl31254) starts at 0000h with A=00, W=00, IS=00, DC0=0000, PC1=0000, clears the scratchpad (`CLR; LR IS,A; ... CI H'40'; BNZ`), and in the first two frames touches 193 distinct addresses between 0000h and 0766h. - In a second of the BIOS waiting at its "G?" prompt, MAME executes **211,186 instructions** (60 frames, 0.991 s): 8.4 phi clocks per instruction on average. The busiest mnemonics are COM, NI, INS, BZ, LR, BNZ, DS, OUTS (the button and controller polling loop). - The window is 60 frames = 0.991232 s, i.e. MAME's frame rate is **60.53 Hz** (its `-listxml` says 60.530717 Hz: a 256 x 264 raster at a 4,090,908 Hz pixel clock). That is not the broadcast 59.94 Hz: see channelf-python docs/video.md (C-list there). ## What MAME can and cannot decide - **Detects:** instruction results and flags on code the BIOS and games run; a rough instruction rate; the disassembly text (a check for our disassembler's spelling). - **Cannot decide:** cycle timing of individual instructions (not checked against Table 3 tonight; a next-session task: run a known loop and compare elapsed cycles with `table3.tsv`); anything about the per-chip register copies (MAME keeps one PC0/PC1/DC0/DC1, [romc-and-the-psus.md](romc-and-the-psus.md)); undefined opcodes (2Dh-2Fh, r = 15, ports 2-3); the floating bus; interrupt timing (the Channel F BIOS does not use interrupts in the window traced). It is never a judge.