# MAME 0.285 as a detector MAME is an emulator (tier 5): it finds differences, it does not decide them. The binary is the machine's installed `mame` (`0.285 (unknown)`). Its Portfolio files carry BSD-3-Clause `license:` lines (read through the first 200 bytes only, raw.githubusercontent.com at tag `mame0285`, 2026-11-26): `src/mame/atari/pofo.cpp`, `src/devices/video/hd61830.cpp` and `.h`, `src/devices/sound/pcd3311.cpp`, `src/devices/bus/pofo/{exp,ccm,ram,rom}.cpp`, `src/devices/cpu/i86/i86.cpp`; `hash/pofo.xml` is CC0-1.0. They are **not opened**: the brief treats MAME's drivers as closed boxes (open decision 2). ## What MAME says it runs (`mame -listxml`, 2026-11-26) | Machine | Description | CPU | Screen | Other chips | | --- | --- | --- | --- | --- | | `pofo` | Portfolio (Atari, 1989), BIOS set `dip1072` | "Intel 8088" at 4,915,200 Hz | LCD 240 x 64, 72.000000 Hz, pixclock 1,105,920 | HD61830B, PCD3311 at 3,578,640 Hz, Speaker; card slot `ccma` (`pofo_card`); software list `pofo` | | `pofo2` | Portfolio 2 (Atari, 1990), `dip1680` | same | LCD 640 x 200, 56 Hz | 82C425 LCD/CRT controller | ## The recipe (run) ```sh MAME_ROMPATH=... flock taskset -c 24-31 nice python -I scripts/mame_trace.py --seconds 4 ``` runs, in a fresh `tests/mame_traces//` (git-ignored): ``` mame pofo -rompath $MAME_ROMPATH -homepath -video none -sound none -nothrottle -noreadconfig -skip_gameinfo -debug -debugger none -log -seconds_to_run N -autoboot_script trace.lua ``` `trace.lua` installs Lua read and write taps over the whole I/O space (`IOR`/`IOW port data mask` lines) and issues `trace cpu.trace,,noloop,{logerror "%X %X %X %X %X %d\n",cs,ip,b@curpc,ax,curflags,totalcycles}`. The CPU's tag is `:u1`; its state names are `IP AX CX DX BX SP BP SI DI ... CURFLAGS ES CS SS DS PC CURPC HALT` (probed). MAME warns "hd61830.bin ROM NEEDS REDUMP" and runs anyway. ## Runs 2026-11-26 (`tests/detectors/mame-pofo-2026-11-26.txt`) | Run | Instructions | Cycles | Cycles/instr. | HLT | Wall time | | --- | ---: | ---: | ---: | ---: | ---: | | 4 s from reset | 835,695 | 19,729,057 | 23.608 | 0 | 49 s (6 MB of logs) | | 10 s from reset | 2,576,782 | 49,220,256 | 19.101 | 0 | ~2 min (19 MB) | - First line `FFFF 0 EA 0 0 0`: the reset vector's far jump at FFFF:0000. - Cycles agree with 4.9152 MHz (19.73 M in 4 s; 49.22 M in 10 s). - `LOOP` ($E2) is 2,498,303 of the 2,576,782 instructions in 10 s: the firmware sits in a delay or wait loop, not in `HLT`. - I/O: 8010/8011 written 570 times each (the HD61830 set-up and the banner text, lcd.md); 8000 read once; 8020, 8040, 8060 written once; 8050/8051 a polled pair (8051 read 52 times); 807C written 6 times (memory-map.md). - A separate 21-second run with `manager.machine.video:snapshot()` at frames 600 and 1400 (no debugger) saved the screen: the copyright banner ("Copyright (c) 1989 DIP / Distributed Information Processing Ltd / Surrey Research Park, Guildford, England / All rights reserved / ... / BIOS: 1.072 Operating system: 1.072"), unchanged between the two frames: with no key pressed the firmware waits at the banner. The PNGs stay in the scratchpad (they show DIP's copyright text, not committed). ## What MAME can and cannot decide - **Can detect:** the firmware's I/O access pattern (where to start on U3), the LCD command stream, the instruction stream for lockstep, a board that boots differently. - **Cannot decide:** the ASIC's real register semantics, wait states, the LCD's frame rate and busy timing, the tone chip's wiring, anything the BIOS does not exercise, and whether the CMOS 80C88 differs from MAME's 8088. - One process at a time, short runs: the family's rule (this repository's runs used a shared `flock`).