pub struct Cpu {
pub memory: MemoryBus,
pub registers: Registers,
pub flags: StatusFlags,
pub stack: Stack,
}
Expand description
A representation of a 6502 microprocessor
Fields§
§memory: MemoryBus
§registers: Registers
§flags: StatusFlags
§stack: Stack
Implementations§
Source§impl Cpu
impl Cpu
Sourcepub fn load<T>(&mut self, code: &[u8], addr: T) -> Result<(), CpuError>
pub fn load<T>(&mut self, code: &[u8], addr: T) -> Result<(), CpuError>
Loads code into the Cpu main memory at an optional offset. If no offset is provided, the Cpu will, by default, load the code into main memory at 0xC000
Sourcepub fn step_n(&mut self, n: u32) -> Result<u64, CpuError>
pub fn step_n(&mut self, n: u32) -> Result<u64, CpuError>
Runs N instructions of code through the Cpu
pub fn reset(&mut self)
Sourcepub fn step(&mut self) -> CpuStepResult
pub fn step(&mut self) -> CpuStepResult
Runs a single instruction of code through the Cpu
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