Struct iz80::Cpu

source ·
pub struct Cpu { /* private fields */ }
Expand description

The Z80 cpu emulator.

Executes Z80 instructions changing the cpu State and Machine

Implementations§

source§

impl Cpu

source

pub fn new() -> Cpu

Returns a Z80 Cpu instance. Alias of new_z80()

source

pub fn new_z80() -> Cpu

Returns a Z80 Cpu instance

source

pub fn new_8080() -> Cpu

Returns an Intel 8080 Cpu instance

source§

impl Cpu

source

pub fn execute_instruction(&mut self, sys: &mut dyn Machine)

Executes a single instruction

Arguments
  • sys - A representation of the emulated machine that has the Machine trait
source

pub fn disasm_instruction(&mut self, sys: &mut dyn Machine) -> String

Returns the instruction in PC disassembled. PC is advanced.

Arguments
  • sys - A representation of the emulated machine that has the Machine trait
source

pub fn set_trace(&mut self, trace: bool)

Activates or deactivates traces of the instruction executed and the state of the registers.

Arguments
  • trace - A bool defining the trace state to set
source

pub fn registers(&mut self) -> &mut Registers

Returns a Registers struct to read and write on the Z80 registers

source

pub fn immutable_registers(&self) -> &Registers

Returns an immutable references to Registers struct to read the Z80 registers

source

pub fn is_halted(&self) -> bool

Returns if the Cpu has executed a HALT

source

pub fn signal_interrupt(&mut self, active: bool)

Maskable interrupt request. It stays signaled until is is deactivated by calling signal_interrupt(false).

source

pub fn signal_nmi(&mut self)

Non maskable interrupt request

source

pub fn signal_reset(&mut self)

Signal reset

source

pub fn cycle_count(&self) -> u64

Returns the current cycle count

Trait Implementations§

source§

impl Default for Cpu

source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.