[−][src]Struct w65c02s::W65C02S
An instance of a W65C02S, encapsulating the entire runtime state of the
processor itself. Not very useful without a System
to go with it.
Implementations
impl W65C02S
[src]
pub fn new() -> W65C02S
[src]
Creates a new W65C02S
instance, initialized in a newly-reset state.
(Unlike a real W65C02S, most registers will be in the all-ones state at
this point.)
pub fn reset(&mut self)
[src]
Resets the CPU. Execution will flounder for a few cycles, then fetch the reset vector and "start over".
pub fn get_pc(&self) -> u16
[src]
Get the current value of the Program Counter, i.e. the next instruction that will (probably) be executed.
pub fn set_pc(&mut self, pc: u16)
[src]
Overwrite the current value of the Program Counter.
pub fn get_a(&self) -> u8
[src]
Get the current value of the Accumulator.
pub fn set_a(&mut self, a: u8)
[src]
Overwrite the current value of the Accumulator.
pub fn get_x(&self) -> u8
[src]
Get the current value of index register X.
pub fn set_x(&mut self, x: u8)
[src]
Overwrite the current value of index register X.
pub fn get_y(&self) -> u8
[src]
Get the current value of index register Y.
pub fn set_y(&mut self, y: u8)
[src]
Overwrite the current value of index register Y.
pub fn get_s(&self) -> u8
[src]
Get the current value of the Stack pointer. The next byte pushed
onto the stack will go into address $01xx
where xx
is this value.
pub fn set_s(&mut self, s: u8)
[src]
Overwrite the current value of the Stack pointer.
pub fn get_p(&self) -> u8
[src]
Get the current value of the Processor status register. Use the
P_*
constants to interpret the value.
pub fn set_p(&mut self, p: u8)
[src]
Overwrite the current value of the Processor status register. Can't be used to change the hardwired 1 bit. You can use this to implement SOB logic; when the SOB pin should transition to active, do something like:
cpu.set_p(cpu.get_p() | P_V);
pub fn get_state(&self) -> State
[src]
Get the current operating state of the CPU. May return a stale value if
called during a step
.
pub fn push<S: System>(&mut self, system: &mut S, value: u8)
[src]
Push a value onto the stack using the given System
.
pub fn spurious_push<S: System>(&mut self, system: &mut S)
[src]
Spurious push during reset.
pub fn pop<S: System>(&mut self, system: &mut S) -> u8
[src]
Pop a value from the stack using the given System
.
pub fn spurious_stack_read<S: System>(&mut self, system: &mut S)
[src]
Spuriously read a value from the next stack slot, like happens during a JSR or RTS or most pulls.
pub fn set_irq(&mut self, irq: bool)
[src]
Change the input on the IRQB
pin. false
means no interrupt pending.
true
means some interrupt is pending. Note that IRQB
is an active-
low pin and that the value you pass to this function is the logical
value and not the electrical one.
pub fn set_nmi(&mut self, nmi: bool)
[src]
Change the input on the NMIB pin. false
means no NMI pending. A
transition from false
to true
triggers an NMI at the next step
.
Note that NMIB
is an active-low pin and that the value you pass to
this function is the logical value and not the electrical one.
This crate does not accurately simulate extremely short NMI pulses, or extremely rapid ones. If these conditions arise on real hardware, chaos will ensue anyway.
pub fn step<S: System>(&mut self, system: &mut S) -> State
[src]
Step the processor once. This means executing an interrupt sequence, fetching an instruction, or doing a spurious read, depending on the current state of the processor. Returns the new state.
Always executes at least one bus cycle. May execute more.
Trait Implementations
impl Clone for W65C02S
[src]
impl Copy for W65C02S
[src]
impl Debug for W65C02S
[src]
impl Eq for W65C02S
[src]
impl PartialEq<W65C02S> for W65C02S
[src]
impl StructuralEq for W65C02S
[src]
impl StructuralPartialEq for W65C02S
[src]
Auto Trait Implementations
impl RefUnwindSafe for W65C02S
impl Send for W65C02S
impl Sync for W65C02S
impl Unpin for W65C02S
impl UnwindSafe for W65C02S
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,