// SPDX-License-Identifier: MIT //! A Rust CMOS 65C02 core transcribed from //! [w65c02-python](https://github.com/alewman/w65c02-python) at `e49aceb` and //! proven equivalent to it at every processor boundary. //! //! **Lineage:** w65c02-python → **w65c02-rust** · //! fixes start in w65c02-python and flow down by merges · [family //! charter](https://github.com/alewman/emulator-lineage/blob/main/docs/charter.md). //! "Matches the Python" is execution fidelity (this crate's proof); how well //! the Python matches real chips is the reference's docs/validation.md. //! //! Each module is the transcription of one `w65c02_python/*.py` module, with //! the same handler names, the same per-row data, the same dispatch table and //! the hardware and source comments carried over: `core`, `alu`, `loads`, //! `shifts`, `bits`, `control`, `nops`, [`dispatch`], [`cpu`], [`state`] and //! [`trace`]. The 65xx-family base (the reference's `CPUFrame`) is 6502-rust's //! [`sixfiveohtwo::frame`]. Where Rust forced a difference, the module header //! says so. //! //! ``` //! use w65c02::{Bus, Cmos65c02, Frame, Signals, G65SC02}; //! //! struct Ram(Vec); //! impl Bus for Ram { //! fn read(&mut self, address: u16, _: &mut Frame, _: Signals) -> u8 { //! self.0[address as usize] //! } //! fn write(&mut self, address: u16, value: u8, _: &mut Frame, _: Signals) { //! self.0[address as usize] = value; //! } //! } //! //! let mut ram = Ram(vec![0; 0x10000]); //! ram.0[0x0200] = 0x1A; // INC A //! let mut cpu = Cmos65c02::new(G65SC02, ram); //! cpu.pc = 0x0200; //! assert_eq!(cpu.step(), 2); //! assert_eq!(cpu.a, 1); //! ``` mod alu; mod bits; mod control; mod core; pub mod cpu; pub mod dispatch; mod loads; mod nops; mod shifts; pub mod state; pub mod trace; pub use crate::alu::{decimal_add, decimal_add_overflow, decimal_subtract}; pub use crate::control::{VECTOR_IRQ, VECTOR_NMI, VECTOR_RESET}; pub use crate::core::{Bus, Cmos65c02, Signals, B, C, D, I, N, STACK, U, V, Z}; pub use crate::cpu::{row_named, Row, CMOS65C02, G65SC02, LYNX2_CELL, R65C02, ROWS, W65C02S}; pub use crate::nops::{Nop5cReads, NopDcFcReads}; pub use crate::state::CpuState; pub use sixfiveohtwo::frame::{Frame, Part, IRQ_LINE, NMI_LATCH, NO_POLL};