use emulator_hal::{BusAccess, Instant as EmuInstant, Error as EmuError, Step, Inspect, Debug, IntoAddress}; use crate::state::{Z80, Z80Error, Z80Address, Status}; impl EmuError for Z80Error {} impl Step for Z80 where Instant: EmuInstant, Bus: BusAccess, { type Instant = Instant; type Error = Z80Error; fn is_running(&mut self) -> bool { self.state.status == Status::Running } fn reset(&mut self, _now: Self::Instant, _bus: &mut Bus) -> Result<(), Self::Error> { self.clear_state(); Ok(()) } fn step(&mut self, now: Self::Instant, bus: &mut Bus) -> Result { let mut executor = self.begin(now, bus)?; let clocks = executor.step_one()?; self.previous_cycle = executor.end(); Ok(now + Instant::hertz_to_duration(self.frequency.as_hz() as u64) * clocks as u32) } } /* impl Step<(&mut MemBus, &mut IoBus)> for Z80 where Instant: EmuInstant, MemBus: BusAccess, IoBus: BusAccess, { type Instant = Instant; type Error = Z80Error; fn is_running(&mut self) -> bool { self.state.status == Status::Running } fn reset(&mut self, _now: Self::Instant, _bus: (&mut MemBus, &mut IoBus)) -> Result<(), Self::Error> { self.clear_state(); Ok(()) } fn step(&mut self, now: Self::Instant, bus: (&mut MemBus, &mut IoBus)) -> Result { let executor = self.begin(now, bus)?; let clocks = executor.step_one()?; self.previous_cycle = executor.end(); Ok(now + Instant::hertz_to_duration(self.frequency.as_hz() as u64) * clocks as u32) } } */