**Lineage:** pokey-python → **pokey-rust** · fixes start in pokey-python and flow down by merges · [family charter](https://github.com/alewman/emulator-lineage/blob/main/docs/charter.md) # pokey-rust Atari's POKEY (C012294) in Rust: four audio channels with polynomial counters and dividers, timers and interrupts, RANDOM, the pot scan, the keyboard scan, and the serial port's audio-affecting parts, advanced one O2 period at a time. A line-by-line transcription of [pokey-python](https://github.com/alewman/pokey-python) at `6ed1ffa` (the commit its `docs/status.md` names for boards to pin), proven equivalent to it, for the Rust boards of the Atari 5200 and 7800. Tier `x-rust` of the family charter. **Modelling level: cycle** (the reference's). "Equivalent" here is fidelity, not hardware confidence: this crate matches pokey-python tick for tick; how well pokey-python matches the chip is the reference's claim, with its evidence, in its `docs/status.md` and `docs/behaviour.md`. use pokey::{POKEY, C012294}; let mut chip = POKEY::new(C012294.clone(), false); // or POKEY::default() chip.write(0x0F, 0x03); // bus access first (SKCTL: leave initialisation mode)... chip.tick(); // ...then the tick of the same cycle chip.levels(); // (c1, c2, c3, c4): volume if the channel's output is 1, else 0 chip.mix(); // the four codes through the fitted output curve, 0.0-1.0 The interface is the reference's (its `docs/adoption.md`), with what Rust forces: the wiring callbacks are boxed closures, and `pot_level` and `on_dump` are handed a `Look` (the chip's `clock` and `dump_active`) because a closure cannot borrow the chip that calls it; `read` takes `&mut self`; `snapshot()` returns a `State` struct; the pins out (`sod()`, `oclk()`, `bclk_out()`, `init_mode()`) are methods. Every difference is listed in the module headers of `src/`. The optional board-side capacitor helper is `pokey::rc::PotRC` (`PotRC::wire(&mut chip, targets)`). With the `serde` feature, `State` and `POKEYVariant` serialise. **Status** (details, commands and the commit they were measured at in [docs/status.md](docs/status.md)): rungs 1-4 pass. The reference's tests transcribed and passing (AcidSAP on 6502-rust: 9 of 10 on both IRQ delays, `twotone` failing as the reference expects); seeded lockstep 68 of 68 traces identical; the conformance kit 11 of 11 and the reference's validation streams 70 of 70; seeded faults all caught. Speed in docs/status.md. scripts/ladder.sh # the gate: fmt, clippy, cargo test, rungs 1-3 FAULTS=1 scripts/ladder.sh # and rung 4, the seeded faults scripts/speed.sh # this crate against the PyPy reference The rungs need the reference: `POKEY_PYTHON` (default `../pokey-python`, or `scripts/fetch_pokeypython.sh`), its interpreter (`REFERENCE_PYTHON`, default its `.venv-pypy`) and `ACIDSAP_DIR` (the reference's fetched AcidSAP); see `scripts/env.sh`. CI runs fmt, clippy and `cargo test` (the conformance kit included, from the committed stimuli). How this was built: [docs/handoff-brief.md](docs/handoff-brief.md). Nothing third-party is committed. Licence: MIT (LICENSE); credits in NOTICE.