# Status **Lineage:** a7800-python → **a7800-rust** · fixes start in a7800-python and flow down by merges · [family charter](https://github.com/alewman/emulator-lineage/blob/main/docs/charter.md) The `x-rust` tier of the Atari 7800 board: a7800-python **`d6b220d`** transcribed, on a2600-rust `f9af024`, 6502-rust `129e742`, pokey-rust `b37263d` (path dependencies; since 2026-11-22 the gate checks a2600-rust `c40bcf6` and 6502-rust `1a7e134`, the same code with documents and reference pins moved after 6502-python's history rewrite, and the reference `f70eeb2`). Every number below is **fidelity** (this board against the reference), not hardware accuracy; the reference's own evidence and open questions are in its docs/status.md and docs/validation.md. ## Measured By `scripts/ladder.sh --faults` on the tree of the commit that records this file (2026-11-19; the reference on PyPy 3.11, `nice -n 19`, `PYPY_GC_NURSERY=1M`; `MAME_HASHPATH` = a2600-python's fetched lists on both sides): | Rung | Command | Result | | --- | --- | --- | | 0. pins | `scripts/ladder.sh` (first step) | siblings at their pins, clean; the reference clone at `f70eeb2`; its venv holds 6502-python `828b619`, a2600-python `4ad24f2`, pokey-python `ea20096` (until 2026-11-22: `d6b220d`, `741419a`, `28fb095`, `6ed1ffa`, the same code) | | 1. tests | `cargo test --release` | 55 passed (the reference's unit tests transcribed, and a mid-frame save-state round trip); fmt and clippy (rustup stable 1.99, `-D warnings`) clean | | 2. lockstep | `scripts/lockstep.py --reference-cache external/refcache` over `scripts/cases.tsv` | **51 of 51 cases identical**, every slice: CPU state, board time (MARIA clocks, Φ2 periods, HALT/RDY periods, slow cycles), MARIA's position, INPTCTRL, the data bus, a CRC of every bus cycle (CPU and DMA), a CRC of every finished line, and the audio (the TIA + POKEY mix) CRC. 27,600 slices in all | | 3. save states | the same with `--save-at-half` (7800 mode) | **37 of 37 identical** (saved half way, loaded into a fresh console, the rest of the trace the reference's uninterrupted run) | | 4a. die traces | `a7800-gates die` (a TIA as board.rs makes it) | 39 of 39 | | 4b. timer ROMs | `a7800-gates timers` (`make_system`, both 7800 rows) | 14 / 14 `NTSC_7800`, 14 / 14 `PAL_7800` | | 4c. smoke | `a7800-gates smoke` (`gates::lockstep` 1,000,000 bus cycles beside a2600-rust's own board, and `gates::run_hashes` 30 frames on both sides) | 93 of 93 identical (200 s) | | 4d. #699 tables | `a7800-gates serial` (PAL_7800, all seven ROMs) | 19,455 of 19,455 cells (76 s) | | 4e. BIOS digests | `a7800-gates bios` against the reference's `scripts/gates_2600.py --bios` | 12 of 12 lines identical (six dumps from each BIOS row, hand-off frame and 60 TIA frames' pixel, audio and register digests, Pitfall II included) | | 5. window | `a7800-play --dump-palettes` vs `scripts/palettes_ref.py`; `a7800-play --judge` | palettes (cool, warm, hot) and the composite option byte-identical to the reference's; the judge (the reference's `m8_frontend.py` transcribed) PASS: hue steps 24.71 / 26.72 / 27.70, 20 frames read back with 0 differing, the keys reach the board, the composite phases opposite; a 400-frame screenshot of Joust (USA) shows its title screen (looked at) | | 6. speed | `a7800-speed CART 3600` (best of 3, a shared machine with the gate running beside it) | Commando from the BIOS x1.53 real time (91.9 frames/s); Asteroids with the sound tap x1.78 (1,800 frames). The reference: 2-5 % of real time | | 7. seeded faults | `scripts/seeded_faults.py` | **22 of 24 caught**; 2 not caught on the cases (below) | Seeded faults, each run through the gate on the cases named in `scripts/seeded_faults.py`: - The reference's board faults, applied here with `a7800-trace --fault`: `fast-tia`, `ignore-lock`, `end-test-zero` (on the C5 titles, Ninja Golf and Crossbow), `last-line-cost-dropped`, `dli-early`, and the detector settings `dli-clear-on-nmi` and `c23-mame` (on the C23 probe): **7 of 7 caught**. - The reference's window faults `keys`, `pixels`, `composite` (`a7800-play --judge`): **3 of 3 caught**. - The reference's script-level faults ported as one-line source faults: `gun-blind`, `two-button-always`, `maria-sees-sally`: **3 of 3 caught**; the data bus not carried over at the hand-off: **not caught** on the 14 2600-mode cases (an equivalent mutant there: the first cycle after the hand-off refills the latch before anything reads its floating bits; the reference's own record catches it only under `gates.lockstep` on Combat, which starts from a different state). - Rust-specific: the DMA engine (CWIDTH's second byte, the VBE fetch's tail, a header's cut-off test), the border colour, the port not ticking the cartridge (POKEY), the sound tap's POKEY weight, the Activision bank latch, port 2's two-button line (caught once a case pressed port 2's buttons: `twobutton/one-on-one-port2`, added for it), a save state that drops the cartridge: **9 of 10 caught**; the Kangaroo bit ignored: **not caught**, a blind spot (no case in the table draws in Kangaroo mode; a title that does would close it). - First-run misses that were the gate's, fixed: `ignore-lock` was aimed at a 2600-mode case (the 7800 board no longer runs after the hand-off), `end-test-zero` at titles whose lists end with a zero byte, and the C23 probe was started through the NTSC BIOS, which refuses the unsigned probe; it now starts directly, as the reference's `scripts/dli_probe.py` runs it. The case table (`scripts/cases.tsv`), all with `--audio`: | Group | Cases | | --- | --- | | the six frame-compare titles, NTSC BIOS, scripted input | Asteroids, Centipede, Dig Dug, Joust, Galaga, Food Fight (760 frames each) | | PAL BIOS row | Centipede, Galaga, Commando (Europe) | | direct start (labelled), both rows | Joust, Kung-Fu Master, Centipede (Europe) | | schemes | SuperGame + POKEY $4000 (Commando), bank 6 at $4000 by code (Meltdown, Xenophobe) and by behaviour (Ninja Golf), 16 KiB RAM (Summer Games), 8 KiB RAM (Impossible Mission), ROM at $4000 (Alien Brigade), Activision (Double Dragon, Rampage), Absolute (F-18 Hornet), mirror RAM (Rescue on Fractalus), linear + POKEY $4000 (Ballblazer), linear 48K (Karateka), banksets (the Bankset Test Suite's 2x32K RAM POKEY $800, 2x52K POKEY $4000, 2x128K, 2x128K RAM) | | controllers | light gun: Barnyard Blaster aimed hit and miss, Crossbow; two-button default: One-on-One (port 1, and port 2), Worm! | | C23 | the reference's `probes/dliprobe.s` (eight DLI phases), NTSC and PAL, started directly | | 2600 mode | Combat direct (both rows); from each BIOS row Combat, Pitfall!, Space Invaders, Adventure, River Raid, Pitfall II (700 frames, Reset and fire pressed, so its DPC music plays: on the PAL row at the cartridge's own rate) | ## Save states The reference has none ("the board has no whole-machine save state yet"; its cartridges have `snapshot()`). `src/state.rs` adds one, proven only by the gate: rung 3 above (36 cases at a frame boundary, half way) and `tests/state.rs` (inside a frame). It is this crate's addition, not a reference behaviour; when the reference gains save states, this one should follow its layout. ## Rust-forced differences (each in its module's header) - MARIA's DMA generators (`yield`, `yield from`) are an explicit resumable state machine (`maria::Engine`), each label resuming where the reference's `next()` would. - MARIA's DMA reads go through `board::Port` (the board's other fields borrowed beside MARIA) and pass `&mut Maria` along, because the decoder reaches MSTAT through mirrors. - The board is 6502-rust's `Bus`: the CPU calls (`note_stall`, NMI/IRQ requests, `dma_stalled`) go to the core's `Frame`. - The connector's `tick` is handed the data bus (the 2600 adapter's snoop source). - The light gun's sensor looks just before each TIA read that asks the pads (the TIA's pad callback cannot reach MARIA); the same render, the same pixel. - 2600 mode: `System2600` holds a2600-rust's `System` (no subclassing); SALLY moves to a2600-rust's bus type by `capture_state`/`restore_state` plus her whole frame. - The sound tap drains the TIA's own sample list when the mix is taken, not inside the callback. - Faults are a bit set; dictionaries are arrays; `round` is `round_ties_even`. ## Upstream Nothing in the reference or in a2600-rust's sockets looked wrong: every comparison was identical at the first run, so nothing was reported upstream. ## Left - CI: `.github/workflows/ci.yml` is written, but a2600-rust `f9af024` has no remote, so CI cannot check it out until it is pushed (no remote here either: local only). - Not in the case table: the High Score Cartridge (no dump of its ROM in the sets the gate reads), paddles and trak-ball (no title declares them), SOUPER/XM (not built in the reference). - The window has been judged headless only; no human has looked at it on a screen.