pub struct Cpu { /* private fields */ }
Expand description
The Central Processing Unit status and registers
Implementations§
source§impl Cpu
impl Cpu
CPU Addressing Modes
The 6502 can address 64KB from 0x0000 - 0xFFFF. The high byte is usually the page and the low byte the offset into the page. There are 256 total pages of 256 bytes.
pub const INSTRUCTIONS: [Instr; 256] = _
source§impl Cpu
impl Cpu
pub fn new(bus: CpuBus) -> Self
pub const fn region_clock_rate(region: NesRegion) -> f32
pub const fn clock_rate(&self) -> f32
pub const fn cycle(&self) -> usize
pub const fn pc(&self) -> u16
pub const fn sp(&self) -> u8
pub const fn a(&self) -> u8
pub const fn x(&self) -> u8
pub const fn y(&self) -> u8
pub const fn status(&self) -> Status
pub const fn corrupted(&self) -> bool
pub fn disasm(&self) -> &str
pub const fn ppu(&self) -> &Ppu
pub fn ppu_mut(&mut self) -> &mut Ppu
pub const fn apu(&self) -> &Apu
pub fn apu_mut(&mut self) -> &mut Apu
pub const fn mapper(&self) -> &Mapper
pub fn mapper_mut(&mut self) -> &mut Mapper
pub const fn joypad(&self, slot: Slot) -> &Joypad
pub fn joypad_mut(&mut self, slot: Slot) -> &mut Joypad
pub fn connect_zapper(&mut self, enabled: bool)
pub const fn zapper(&self) -> &Zapper
pub fn zapper_mut(&mut self) -> &mut Zapper
pub fn load_cart(&mut self, cart: Cart)
pub const fn cart_battery_backed(&self) -> bool
pub fn sram(&self) -> &[u8] ⓘ
pub fn load_sram(&mut self, sram: Vec<u8>)
pub fn wram(&self) -> &[u8] ⓘ
sourcepub fn add_genie_code(&mut self, genie_code: String) -> NesResult<()>
pub fn add_genie_code(&mut self, genie_code: String) -> NesResult<()>
pub fn remove_genie_code(&mut self, genie_code: &str)
pub const fn ppu_cycle(&self) -> u32
pub const fn ppu_scanline(&self) -> u32
pub fn frame_buffer(&self) -> &[u16]
pub const fn frame_number(&self) -> u32
pub const fn audio_channel_enabled(&self, channel: Channel) -> bool
pub fn toggle_audio_channel(&mut self, channel: Channel)
pub fn audio_samples(&self) -> &[f32]
pub fn clear_audio_samples(&mut self)
pub const fn four_player(&self) -> FourPlayer
pub fn set_four_player(&mut self, four_player: FourPlayer)
pub fn set_cycle_accurate(&mut self, enabled: bool)
pub fn irq(&mut self)
pub fn peek_stack(&self) -> u8
pub fn peek_stack_u16(&self) -> u16
pub fn read_u16(&mut self, addr: u16) -> u16
pub fn peek_u16(&self, addr: u16) -> u16
pub fn disassemble(&mut self, pc: &mut u16)
pub fn trace_instr(&mut self)
Trait Implementations§
source§impl<'de> Deserialize<'de> for Cpu
impl<'de> Deserialize<'de> for Cpu
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Mem for Cpu
impl Mem for Cpu
fn read(&mut self, addr: u16, access: Access) -> u8
fn peek(&self, addr: u16, access: Access) -> u8
fn write(&mut self, addr: u16, val: u8, access: Access)
fn read_u16(&mut self, addr: u16, access: Access) -> u16
fn peek_u16(&self, addr: u16, access: Access) -> u16
fn write_u16(&mut self, addr: u16, val: u16, access: Access)
Auto Trait Implementations§
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