// SPDX-License-Identifier: MIT //! The machine rows: Lynx I and Lynx II differ in data only (`machine.py`). //! //! Default row: Lynx II (owner's decision 1, 2026-11-12). //! //! Differences forced by Rust: the Python row holds the CPU class and a readback function //! object; here the CPU row is `w65c02`'s [`Row`] value and the readback a function //! pointer. `MACHINES` (a dict) is [`machine_named`]. use w65c02::{Row, G65SC02, LYNX2_CELL}; fn mapctl_lynx1(written: u8) -> u8 { // TEST ROM (LT page-mode guide, lynx-tests page-mode/memio): Lynx I reads back what // was written ($83 -> $83). written } fn mapctl_lynx2(written: u8) -> u8 { // TEST ROM (LT page-mode guide): Lynx II keeps bits 0-3, forces 4-6 high and inverts // bit 7: $03 -> $F3, $83 -> $73 (C3). (written | 0x70) ^ 0x80 } #[derive(Clone, Copy, Debug)] pub struct Machine { pub name: &'static str, /// The CPU row (w65c02-rust). DOC + TEST ROM: lynx-tests cpu test 7 and AtariAge 283383 /// (Lynx I = 65SC02 subset; Lynx II executes RMB/SMB/BBR/BBS). WAI/STP: no claim (C1). pub cpu: Row, pub mapctl_readback: fn(u8) -> u8, /// Lynx II has two audio outputs and MSTEREO (C8); Lynx I is mono. pub stereo: bool, } pub const LYNX1: Machine = Machine { name: "lynx1", cpu: G65SC02, mapctl_readback: mapctl_lynx1, stereo: false, }; pub const LYNX2: Machine = Machine { name: "lynx2", cpu: LYNX2_CELL, mapctl_readback: mapctl_lynx2, stereo: true, }; pub const MACHINES: [Machine; 2] = [LYNX1, LYNX2]; pub const DEFAULT: Machine = LYNX2; /// `MACHINES[name]`. pub fn machine_named(name: &str) -> Option { MACHINES.into_iter().find(|m| m.name == name) }