rustynes_cpu/lib.rs
1//! Cycle-accurate Ricoh 2A03 CPU core (6502 derivative without BCD mode).
2//!
3//! See `docs/cpu-6502.md` in the workspace root for the implementation
4//! specification, and `ref-docs/research-report.md` §CPU for the source
5//! material this is derived from.
6//!
7//! All 151 documented 6502 opcodes plus the 105 unofficial / undocumented
8//! ones are implemented at per-cycle granularity, including the JAM/KIL/STP
9//! halt opcodes, NMI / IRQ / BRK handling, and the page-crossing dummy reads
10//! that the test ROMs check for.
11
12#![no_std]
13#![warn(missing_docs)]
14
15extern crate alloc;
16
17mod bus;
18mod cpu;
19pub mod disasm;
20pub mod scheduler;
21mod snapshot;
22mod status;
23
24pub use bus::Bus;
25pub use cpu::Cpu;
26pub use disasm::{DisasmLine, disassemble_at};
27pub use scheduler::M2Phase;
28pub use snapshot::{CPU_SNAPSHOT_VERSION, CpuSnapshotError};
29pub use status::Status;
30
31/// Returns the crate version string.
32#[must_use]
33pub const fn version() -> &'static str {
34 env!("CARGO_PKG_VERSION")
35}
36
37#[cfg(test)]
38mod tests {
39 use super::*;
40
41 #[test]
42 fn version_is_non_empty() {
43 assert!(!version().is_empty());
44 }
45}