# lynx-rust: handoff brief Written 2026-11-14 before any code, by the Transcription agent (Claude Opus 5.5). **Lineage:** lynx-python → **lynx-rust** · fixes start in lynx-python and flow down by merges · [family charter](https://github.com/alewman/emulator-lineage/blob/main/docs/charter.md) ## Tier and role `x-rust` (charter, "The tiers"): a faithful executable transcription of the Atari Lynx board `lynx-python`, proven identical to it: every CPU bus cycle (address, value, direction, board time) and every picture, per slice, in lockstep. Only what Rust forces differs; cleverness belongs to a future `lynx-rust-fast`. The goal is a Lynx that plays at real speed, later a fast fork and a play site. ## The pins | What | Pin | Why | | --- | --- | --- | | Reference | `lynx-python` `bc5f35e` (2026-11-14, close-out of the second Specification pass) | its docs/status.md and docs/restart.md name the transcription as the next step after this commit | | CPU (Rust) | `w65c02-rust` `99c3e19` (crate `w65c02`), a transcription of `w65c02-python` `e49aceb` | the family's 65C02 core; rows `G65SC02` (Lynx I) and `LYNX2_CELL` (Lynx II) | | CPU (reference) | `w65c02-python` `9ca4a2f` (lynx-python's pin) | | `9ca4a2f` and `e49aceb` differ in comments and docstrings only: an AST comparison of every changed file under `src/` with docstrings removed finds no difference (re-run on 2026-11-14: 0 of the changed `.py` files differ). The two cores are the same behaviour; the lockstep proves it again on every case, since the Rust board runs `w65c02-rust` and the reference runs `w65c02-python` `9ca4a2f`. ## Provenance (inherited) A transcription inherits its reference's provenance, so lynx-python's restart rules (docs/restart.md there) bind this repository too: no GPL, LGPL or unlicensed source is read (Gearlynx, Handy beyond its zlib files, Mednafen, Holani's source, MAME's Lynx driver, the MiSTer Lynx core); the archived `zzz-lynx-python` is not read; emulators are run only as closed boxes. This repository is written from lynx-python (MIT) alone, plus the MIT cores it pins. The archived a2600-rust and a2600-rust-fast are not read either. The model board transcriptions are gameboy-rust (the charter's reference implementation) and famicom-rust. ## What is transcribed Module for module, same names, order, structure, comments and evidence tags: `machine`, `board`, `mikey/{mod,timers,display,uart}`, `suzy/{mod,math,engine}`, `cart/{port,eeprom,formats,table,loader,decrypt,convert}`, `bootrom`, `romsets`, `picture`, `sound`, `testrom`, and the two entry points (`python -m lynx_python` -> `lynx`, `lynx-play` -> `lynx-play` behind the `frontend` feature, SDL2) plus the cart tool (`python -m lynx_python.cart` -> `lynx-cart`). The board owns the bus: the CPU calls it per cycle with the `sync`/`fetch`/`opcode` signals `w65c02-rust` provides (its `Bus` trait). Expected Rust-forced differences (each stated in its module header): - Python's callbacks between chips (the timer bank's `on_borrow`, the UART's `pending`, the display's back-reference to Mikey, the sprite engine's `bus`) become arguments, return values or a small queue drained in the same order, since Rust has no shared mutable references. - The sprite engine is a Python generator; in Rust it is an explicit state machine that stops at exactly the same `yield` points (and can be saved, which a generator cannot). - Python's floor division and modulo of negative numbers are `div_euclid`/`rem_euclid`. - Save states: the reference has none (a generator cannot be pickled). The Rust board saves and loads its whole state (serde + bincode) so the gate can run `--save-at-half`; the reference runs uninterrupted, as in gameboy-rust. ## The gate `scripts/ladder.sh`: fmt, clippy, tests, then `scripts/lockstep.py` over the case tables (the reference traced by `scripts/lynx_trace.py` on its own PyPy venv `external/venv`, a clone of lynx-python at `bc5f35e` in `external/lynx-python`; traces cached by case with `--reference-cache`), the same tables with `--save-at-half`, and `scripts/seeded_faults.py`. One line per slice (1/60 s of board time, 266,667 ticks): CPU registers, board time, interrupt bits, display and Suzy state, a CRC-32 of every CPU bus cycle, of the finished picture and of RAM, and with `--audio` of the slice's samples. Cases: the boot ROM path (every case boots through the real boot ROM, which is read in place through `$MAME_ROMPATH`), the hardware-test ROMs (lynx-tests 1.4.9 built by lynx-python, read in place), the smoke titles by name under `$NO_INTRO_DIR`, the EEPROM titles, both machine rows, rotation, scripted input, the `paths` Suzy timeline. ## Limits No push, remote or tag. lynx-python, w65c02-rust and w65c02-python are never modified; a behaviour that looks wrong in the reference is reported upstream with a repro, not fixed here. ROMs and the boot ROM are read in place, never copied or committed.