pub struct CPU {
pub reg: Registers,
pub halt: bool,
pub iff1: bool,
pub iff2: bool,
pub invalid_op: bool,
pub mem: Memory,
/* private fields */
}
Expand description
Z80 CPU emulation
Fields§
§reg: Registers
§halt: bool
§iff1: bool
§iff2: bool
§invalid_op: bool
§mem: Memory
Implementations§
Source§impl CPU
impl CPU
Sourcepub fn do_op(&mut self, bus: &dyn Bus, ext: bool) -> i64
pub fn do_op(&mut self, bus: &dyn Bus, ext: bool) -> i64
execute a single ‘main-instruction’
This function may be called recursively for prefixed instructions
- ‘m’ - index of 16-bit register (may be HL, IX or IY)
- ‘d’ - the d in (IX+d), (IY+d), 0 if m is HL
returns number of cycles the instruction takes
pub fn irq(&mut self)
pub fn reti(&mut self, bus: &dyn Bus) -> i64
pub fn handle_irq(&mut self, bus: &dyn Bus) -> i64
pub fn halt(&mut self)
pub fn push(&mut self, val: RegT)
pub fn pop(&mut self) -> RegT
pub fn rst(&mut self, val: RegT)
pub fn alu8(&mut self, alu: usize, val: RegT)
pub fn add8(&mut self, add: RegT)
pub fn adc8(&mut self, add: RegT)
pub fn sub8(&mut self, sub: RegT)
pub fn sbc8(&mut self, sub: RegT)
pub fn cp8(&mut self, sub: RegT)
pub fn neg8(&mut self)
pub fn and8(&mut self, val: RegT)
pub fn or8(&mut self, val: RegT)
pub fn xor8(&mut self, val: RegT)
pub fn inc8(&mut self, val: RegT) -> RegT
pub fn dec8(&mut self, val: RegT) -> RegT
pub fn rot(&mut self, op: usize, val: RegT) -> RegT
pub fn rlc8(&mut self, val: RegT) -> RegT
pub fn rlca8(&mut self)
pub fn rrc8(&mut self, val: RegT) -> RegT
pub fn rrca8(&mut self)
pub fn rl8(&mut self, val: RegT) -> RegT
pub fn rla8(&mut self)
pub fn rr8(&mut self, val: RegT) -> RegT
pub fn rra8(&mut self)
pub fn sla8(&mut self, val: RegT) -> RegT
pub fn sll8(&mut self, val: RegT) -> RegT
pub fn sra8(&mut self, val: RegT) -> RegT
pub fn srl8(&mut self, val: RegT) -> RegT
pub fn rld(&mut self)
pub fn rrd(&mut self)
pub fn bit(&mut self, val: RegT, mask: RegT)
pub fn ibit(&mut self, val: RegT, mask: RegT)
pub fn add16(&mut self, acc: RegT, add: RegT) -> RegT
pub fn adc16(&mut self, acc: RegT, add: RegT) -> RegT
pub fn sbc16(&mut self, acc: RegT, sub: RegT) -> RegT
pub fn djnz(&mut self) -> i64
pub fn daa(&mut self)
pub fn cpl(&mut self)
pub fn scf(&mut self)
pub fn ccf(&mut self)
pub fn ret(&mut self) -> i64
pub fn call(&mut self) -> i64
pub fn retcc(&mut self, y: usize) -> i64
pub fn callcc(&mut self, y: usize) -> i64
pub fn ldi(&mut self)
pub fn ldd(&mut self)
pub fn ldir(&mut self) -> i64
pub fn lddr(&mut self) -> i64
pub fn cpi(&mut self)
pub fn cpd(&mut self)
pub fn cpir(&mut self) -> i64
pub fn cpdr(&mut self) -> i64
pub fn inp(&mut self, bus: &dyn Bus, port: RegT) -> RegT
pub fn outp(&mut self, bus: &dyn Bus, port: RegT, val: RegT)
pub fn ini(&mut self, bus: &dyn Bus)
pub fn ind(&mut self, bus: &dyn Bus)
pub fn inir(&mut self, bus: &dyn Bus) -> i64
pub fn indr(&mut self, bus: &dyn Bus) -> i64
pub fn outi(&mut self, bus: &dyn Bus)
pub fn outd(&mut self, bus: &dyn Bus)
pub fn otir(&mut self, bus: &dyn Bus) -> i64
pub fn otdr(&mut self, bus: &dyn Bus) -> i64
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