# Status **Lineage:** a5200-python → **a5200-rust** · fixes start in a5200-python and flow down by merges · [family charter](https://github.com/alewman/emulator-lineage/blob/main/docs/charter.md) Charter tier `x-rust`: a transcription of a5200-python at `cf82d44` (save states anywhere, save-state version 4), proven identical to it per frame. Every claim here is about fidelity to the reference ("the Rust board matches the Python"), not about the hardware; the hardware account is the reference's (its docs/status.md, docs/claims.md). Measured 2026-11-14 to 2026-11-19 at `805231d`. Pins: reference a5200-python `84225d9` (`d41b233` until a5200-python's history rewrite of 2026-11-22 took its GPL Atari800 driver out of every commit; the same board code; clone at `external/a5200-python`, run by the `.venv-pypy` of an a5200-python checkout beside this repository, PyPy 3.11 with 6502-python `828b619` and pokey-python `ea20096`; repinned 2026-11-22 from `cf82d44`, `741419a` and `6ed1ffa`, the same code: `d41b233` is `cf82d44` with its cores repinned after 6502-python's history rewrite of 2026-11-21, and the rows below name the commits they were measured at); CPU 6502-rust `71747eb` (git); POKEY pokey-rust `b37263d` (git, `serde`). The `844355d` reference traces are kept in `external/refcache-844355d`; `external/refcache` was regenerated at `cf82d44`. ## The gate (`scripts/ladder.sh`) Each case runs on both boards; one line per frame holds the CPU registers, board time and frame count, ANTIC's position, the board's halted/stalled/lost-NMI counters, the data-bus latch, the /IRQ line, a CRC-32 of every bus cycle of the frame (CPU reads and writes, ANTIC DMA, refresh, WSYNC-repeated reads, each with its machine cycle, address and value) and a CRC-32 of the frame buffer; with `--audio` also a CRC-32 of the AudioTap's samples. Reference traces are cached in `external/refcache` by case. Save states are judged three ways, always against the reference's uninterrupted trace: at a frame boundary (`--save-at`), inside a frame (`--save-mid SLICE:WHERE`: a cycle count past the frame boundary, or the first instruction boundary with a WSYNC stall pending, POKEY's /IRQ risen but not yet passed to the CPU, /IRQ held with I set, or an NMI pending: the save points of the reference's tests/test_state.py), and over the whole tables at a fixed point inside the half-way frame (`--save-mid-half cycle-12345`). Each saves through bytes, loads into a fresh console and goes on there; the audio tap (host state) moves across. | Rung | Command | Result | | --- | --- | --- | | unit tests | `cargo test --release` | **41 pass**, 5 ignored (the reference's tests where they test behaviour; the PyPy attribute guard has no counterpart). `tests/state_anywhere.rs` transcribes cf82d44's new test_state.py: the synthetic busy BIOS saved at nine points with the pads changed after the save, restored from bytes and from the value (9), the lag test, the machine-row refusal | | slow unit tests | `cargo test --release --test state_anywhere -- --ignored` (`$NO_INTRO_DIR`, BIOS) | **5 pass**: the Missile Command repro, a save at frame 600 plus 12,345 cycles on Missile Command, Centipede, Star Raiders, Pac-Man, 6 frames on with sound | | Acid5200 natively | `a5200-acid` | 46 of 48: ANTIC 20/20, CPU 7/7, GTIA 10/11 (`gtia_vdelay`), POKEY 9/10 (`pokey_twotone`), every frame count and message as the reference records them | | the reference's seeded faults, natively | `a5200-acid --fault drop_dummy_read cpu_bugs cpu_timing`; `--fault steal_one_short antic_dmapattern` | each caught, with the reference's messages | | lockstep, main table | `lockstep.py --cases scripts/cases.tsv` | **30 of 30 identical** (25,060 frames): 4-port row: every cartridge class; 2-port row (BIOS CO19156A): five titles, PAM v2.3, two Acid5200 tests; trak-ball x6 (port 1 and 2, one rolling at the half-way save: the former `cases-upstream.tsv` case); keypads x4 | | lockstep, Acid5200 | `--cases scripts/cases-acid.tsv` | **49 of 49 identical** | | lockstep, smoke list | `--cases scripts/cases-smoke.tsv` | **38 of 38 identical** | | lockstep, mid-frame saves | `--cases scripts/cases-midframe.tsv` (written by `scripts/midframe_cases.py`; the synthetic case by `scripts/busy_case.py`, from the reference's own test module) | **13 of 13 identical** (4,140 frames): the synthetic busy BIOS under the test's inputs, one case per save point (frame boundary, cycles 1, 7001, 15013, 29801, WSYNC pending, /IRQ edge unsynced, /IRQ held, NMI pending); Missile Command and Centipede (trak-ball), Star Raiders (keypad), Pac-Man (stick) under the test's inputs, 900 frames, nine mid-frame saves each, every save point reached on every title | | save at a frame boundary | the three tables with `--save-at-half` | **117 of 117 identical** | | save inside a frame | the three tables with `--save-mid-half cycle-12345` | **117 of 117 identical** | | audio | `--extra=--audio`: cases.tsv plain and `--save-at-half`; cases-midframe.tsv | **30 of 30**, **30 of 30**, **13 of 13 identical** | Total under the gate: 130 cases, 82,940 frames, every one identical; 117 more with a frame-boundary save, 117 with a mid-frame save, 13 mid-frame cases with 45 saves in all; 73 with audio. ## Seeded faults (`scripts/seeded_faults.py`) At `805231d` (2026-11-19): every fault is judged over cases.tsv, cases-acid.tsv and cases-midframe.tsv; save-state faults also with `--save-at-half` and `--save-mid-half cycle-12345`; audio faults with `--extra=--audio`. **30 of 37 caught**; 5 of the 7 misses are equivalent mutants; 2 are recorded blind spots. Caught: the reference's two (`drop_dummy_read`, `steal_one_short`, switched on in the source); ANTIC refresh slots, VCOUNT timing, VBI NMI cycle, character display delay, wide playfield stop; GTIA luma bit 0, player-player collisions, priority multicolour term, hires luminance; board RDY delay, refresh bus, NMI lost on the P push, $F000 mirror; 16K two-chip layout, Bounty Bob first window; pot scan step, keypad code, trak-ball lag; audio speaker weight (Acid5200's suite and `gtia_consol`) and sample step. Save state, each removing one restored field or putting the old restore back: the /IRQ line (`_irq_line`: caught by the mid-frame saves only, on `busy/irq-edge-unsynced` and Star Raiders), the trak-ball lag (13 cases, the former upstream case among them), the trak-ball pins (8), the pot targets (33), restore by `apply()` (11: the trak-ball titles and the synthetic case), the pot charge, GTIA's CONSOL pin, and the floating-bus latch (5 cases, all mid-frame saves: equivalent at a frame boundary, live inside a frame). Equivalent (not counted as blind spots): the line buffer's period 63 -> 64 (reset at cycle 8, steps at most 48 times a line); the frame-row bookkeeping `hcount < 100` -> `< 50` (GTIA's line edge never falls at cycles 50-99); the saved last-read address (read only under the `drop_dummy_read` fault); the saved stack-write count (an interrupt sequence's dummy reads clear it first); the saved /IRQ level for the next cycle `_irq_next` (it equals POKEY's /IRQ after every cycle; not caught even by the save taken while `_irq_next != _irq_line`). The last two are the reference's own analysis (a5200-python docs/status.md, cf82d44), which these misses agree with. The three blind spots recorded at `e964cfd`: - **the saved /IRQ level: closed.** The fault as first written (`_irq_next`) is an equivalent mutant at instruction boundaries, where every save is taken; the field that carries the level, `_irq_line`, is now caught by the mid-frame saves. - **COLPM0's write delay 1 -> 2 colour clocks: still a blind spot.** It is a timing fault, not a save-state one, so mid-frame saves cannot reach it; no case writes COLPM0 inside a visible colour clock, including the four mid-frame titles. - **the 2-port row's port mask `& 1` -> `& 3`: still a blind spot.** No case's program selects ports 3-4 on that row. Two extra cases tried (Super Breakout on the 2-port row in its four-player mode, keys and the upper button held on ports 1-2 through play) were identical to the reference but did not catch it either, so they were not kept. ## Speed Native, release build, this shared machine, `a5200 ROM --frames 1800`, user CPU time, best of three, at `d4f4091` (the repin changes no hot path): Pac-Man 6.3x real time (375 frames/s), Rescue on Fractalus! 8.4x, Star Raiders 6.1x. The reference on PyPy runs Pac-Man at 0.28x (16.9 frames/s, its README). Real time is 59.92 frames/s. ## The window `a5200-play` (feature `frontend`, SDL2) is judged headless only (dummy video and audio drivers): a scripted START and lower button on Pac-Man give, at frame 600, the same frame-buffer CRC as `a5200-trace` with the same presses, and the PNG it writes shows the maze. **No human has looked at it or played it.** ## Findings about the reference **Fixed upstream: a save taken while a trak-ball rolled did not continue identically** (a5200-python 844355d; repro `scripts/trak_state_repro.py`). Reported with the repro, fixed in a5200-python `cf82d44` (with three more save-state bugs of the same class its new tests found: pad key sets shared with the snapshot, targets re-derived from pads changed after the frame's inputs, GTIA's trigger latches re-set on restore) and carried down here at `805231d`. The case now sits in `cases.tsv` and passes with every round trip. Nothing else in the reference looked wrong. Unused there and here: `Machine.trig3_wired_to_trig1` (a row field nothing reads) and `antic.K_EXTRA`. ## What is left 1. The two open blind spots above (COLPM0's write delay, the 2-port port mask) want a case that reaches them; neither is a save-state question. 2. A human session with `a5200-play` at a screen. 3. No Super Cart dump exists locally, so that class is under the unit test only, not the gate. 4. The next tiers: a5200-rust-fast, then a play site.