pub struct Cpu {
pub a: u8,
pub x: u8,
pub y: u8,
pub sp: u8,
pub pc: u16,
pub status: u8,
pub cycles: u8,
pub bus: Box<dyn Bus>,
pub variant: Variant,
pub enable_illegal_opcodes: bool,
pub current_instruction_string: String,
pub debug: usize,
/* private fields */
}Expand description
The emulated 6502 CPU
Fields§
§a: u8The 8-bit accumulator
x: u8The 8-bit x index register
y: u8The 8-bit y index register
sp: u8The 8-bit stack pointer
pc: u16The 16-bit program counter
status: u8The status flags
cycles: u8The number of cycles remaining
bus: Box<dyn Bus>The bus that the CPU is connected to
variant: VariantThe variant of the CPU
enable_illegal_opcodes: boolWhether illegal instructions are allowed
current_instruction_string: StringThe current instruction string
debug: usizeDebug modes 0: No debug 1: Print each instruction 2: Print each cycle
Implementations§
Source§impl Cpu
impl Cpu
Sourcepub fn change_variant(&mut self, variant: Variant)
pub fn change_variant(&mut self, variant: Variant)
Set the CPU variant
Sourcepub fn set_illegal_opcodes(&mut self, value: bool)
pub fn set_illegal_opcodes(&mut self, value: bool)
Set the enable_illegal_opcodes flag
Sourcepub fn get_status_string(&self) -> String
pub fn get_status_string(&self) -> String
Get the status string for the CPU (NV-BDIZC)
Sourcepub fn get_cycles(&self, opcode: u8) -> u8
pub fn get_cycles(&self, opcode: u8) -> u8
Get the number of cycles for an instruction
Sourcepub fn get_register(&self, register: &str) -> u8
pub fn get_register(&self, register: &str) -> u8
Get the value of a register
Auto Trait Implementations§
impl Freeze for Cpu
impl !RefUnwindSafe for Cpu
impl !Send for Cpu
impl !Sync for Cpu
impl Unpin for Cpu
impl !UnwindSafe for Cpu
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more