// SPDX-License-Identifier: MIT //! A Rust Sony SPC700 core transcribed from //! [spc700-python](https://github.com/alewman/spc700-python) at `552b24a` and //! proven equivalent to it at every processor boundary. //! //! **Lineage:** spc700-python → **spc700-rust** · //! fixes start in spc700-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 the S-SMP is the reference's docs/validation.md. //! //! Each module is the transcription of one `spc700_python/*.py` module, with //! the same handler names, the same dispatch table and the hardware comments //! carried over: `core` (`_core.py`), [`flags`], `alu`, `bit`, `word`, `moves`, //! `control`, [`dispatch`], [`opcodes`], `cpu`, [`state`], [`trace`] (with //! `debug.py`'s boundary kinds), [`harness`] and [`replay`]. Where Rust forced a //! difference, the module header says so. //! //! ``` //! use spc700::{Bus, Signals, Spc700}; //! //! struct Ram(Vec); //! impl Bus for Ram { //! fn read(&mut self, address: u16, _: Signals) -> u8 { //! self.0[address as usize] //! } //! fn write(&mut self, address: u16, value: u8, _: Signals) { //! self.0[address as usize] = value; //! } //! } //! //! let mut ram = Ram(vec![0; 0x10000]); //! ram.0[0x0200] = 0x3D; // INC X //! let mut cpu = Spc700::new(ram); //! cpu.pc = 0x0200; //! assert_eq!(cpu.step(), 2); // the fetch and a dummy read of PC //! assert_eq!(cpu.x, 1); //! ``` mod alu; mod bit; mod control; mod core; mod cpu; pub mod dispatch; pub mod flags; pub mod harness; mod moves; pub mod opcodes; pub mod replay; pub mod state; pub mod trace; mod word; pub use crate::control::{BRANCH_FLAG, BRK_VECTOR, TCALL_BASE, UPPER_PAGE}; pub use crate::core::{pack, Bus, Signals, Spc700, STACK_PAGE}; pub use crate::cpu::RESET_VECTOR; pub use crate::flags::*; pub use crate::state::CpuState;