[−][src]Trait spectrusty_core::chip::ControlUnit
This trait provides the interface for running the emulation and accessing instances of peripheral devices.
It's being implemented by the emulators of core chipsets.
Associated Types
type BusDevice: BusDevice
[src]
A type of a chain of emulated peripheral devices should be declared here.
This determines which devices, the emulated computer will be able to interact with.
An associated constant: BusDevice::Timestamp must match the associated type declared for implementations of z80emu traits such as Io::Timestamp or Memory::Timestamp.
Required methods
pub fn bus_device_mut(&mut self) -> &mut Self::BusDevice
[src]
Returns a mutable reference to the instance of the first bus device in the device chain.
pub fn bus_device_ref(&self) -> &Self::BusDevice
[src]
Returns a reference to the the instance of the first bus device in the device chain.
pub fn into_bus_device(self) -> Self::BusDevice
[src]
Destructs self and returns the instance of the bus device.
pub fn reset<C: Cpu>(&mut self, cpu: &mut C, hard: bool)
[src]
Performs a system reset.
When hard
is:
true
emulates a RESET signal being active for thecpu
and all bus devices.false
executes aRST 0
instruction on thecpu
but without forwarding the clock counter.
In any case, this operation is always instant.
pub fn nmi<C: Cpu>(&mut self, cpu: &mut C) -> bool
[src]
Triggers a non-maskable interrupt. Returns true
if NMI was accepted.
Returns false
when the cpu
has just executed an EI
instruction or one of 0xDD
, 0xFD
prefixes.
In this instance, calling this method is a no-op, and it returns false
.
For more details see z80emu::Cpu::nmi.
pub fn execute_next_frame<C: Cpu>(&mut self, cpu: &mut C)
[src]
Conditionally prepares the internal state for the next frame and executes instructions on the cpu
as fast as possible, until the near end of that frame.
pub fn ensure_next_frame(&mut self)
[src]
Conditionally prepares the internal state for the next frame, advances the frame counter, and wraps the T-state counter if it is near the end of a frame.
This method should be called after all side effects (e.g. video and audio rendering) have been taken care of. Usually, implementations will clear internal data from a previous frame.
Both ControlUnit::execute_next_frame and ControlUnit::execute_single_step invoke this method internally, so the only reason to call this method from the emulator program would be to make sure internal buffers are empty before feeding the implementation with external data that will be consumed by devices during the next frame.
pub fn execute_single_step<C: Cpu, F: FnOnce(CpuDebug)>(
&mut self,
cpu: &mut C,
debug: Option<F>
) -> Result<(), ()>
[src]
&mut self,
cpu: &mut C,
debug: Option<F>
) -> Result<(), ()>
Executes a single instruction on the cpu
with the option to pass a debugging function.
If the T-state counter value is near the end of a frame, prepares the internal state for the next frame before executing the next instruction.