[−][src]Trait spectrusty::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
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][z80emu::host] traits such as Io::Timestamp or Memory::Timestamp.
Required methods
fn bus_device_mut(&mut self) -> &mut Self::BusDevice
Returns a mutable reference to the instance of the first bus device in the device chain.
fn bus_device_ref(&self) -> &Self::BusDevice
Returns a reference to the the instance of the first bus device in the device chain.
fn into_bus_device(self) -> Self::BusDevice
Destructs self and returns the instance of the bus device.
fn reset<C>(&mut self, cpu: &mut C, hard: bool) where
C: Cpu,
C: Cpu,
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.
fn nmi<C>(&mut self, cpu: &mut C) -> bool where
C: Cpu,
C: Cpu,
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].
fn execute_next_frame<C>(&mut self, cpu: &mut C) where
C: Cpu,
C: Cpu,
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.
fn ensure_next_frame(&mut self)
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.
fn execute_single_step<C, F>(
&mut self,
cpu: &mut C,
debug: Option<F>
) -> Result<(), BreakCause<(), ()>> where
C: Cpu,
F: FnOnce(CpuDebug),
&mut self,
cpu: &mut C,
debug: Option<F>
) -> Result<(), BreakCause<(), ()>> where
C: Cpu,
F: FnOnce(CpuDebug),
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.
Implementors
impl<B, X> ControlUnit for Ula3<B, X> where
B: BusDevice,
B::Timestamp: From<VFrameTs<Ula3VidFrame>>,
X: MemoryExtension,
[src]
B: BusDevice,
B::Timestamp: From<VFrameTs<Ula3VidFrame>>,
X: MemoryExtension,
type BusDevice = B
fn bus_device_mut(&mut self) -> &mut Self::BusDevice
[src]
fn bus_device_ref(&self) -> &Self::BusDevice
[src]
fn into_bus_device(self) -> Self::BusDevice
[src]
fn reset<C: Cpu>(&mut self, cpu: &mut C, hard: bool)
[src]
fn nmi<C: Cpu>(&mut self, cpu: &mut C) -> bool
[src]
fn execute_next_frame<C: Cpu>(&mut self, cpu: &mut C)
[src]
fn ensure_next_frame(&mut self)
[src]
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<(), ()>
impl<B, X> ControlUnit for Ula128<B, X> where
B: BusDevice,
B::Timestamp: From<VFrameTs<Ula128VidFrame>>,
X: MemoryExtension,
[src]
B: BusDevice,
B::Timestamp: From<VFrameTs<Ula128VidFrame>>,
X: MemoryExtension,
type BusDevice = B
fn bus_device_mut(&mut self) -> &mut Self::BusDevice
[src]
fn bus_device_ref(&self) -> &Self::BusDevice
[src]
fn into_bus_device(self) -> Self::BusDevice
[src]
fn reset<C: Cpu>(&mut self, cpu: &mut C, hard: bool)
[src]
fn nmi<C: Cpu>(&mut self, cpu: &mut C) -> bool
[src]
fn execute_next_frame<C: Cpu>(&mut self, cpu: &mut C)
[src]
fn ensure_next_frame(&mut self)
[src]
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<(), ()>
impl<M, B, X, V> ControlUnit for Scld<M, B, X, V> where
M: PagedMemory8k,
B: BusDevice,
B::Timestamp: From<VFrameTs<V>>,
X: MemoryExtension,
V: VideoFrame,
[src]
M: PagedMemory8k,
B: BusDevice,
B::Timestamp: From<VFrameTs<V>>,
X: MemoryExtension,
V: VideoFrame,
type BusDevice = B
fn bus_device_mut(&mut self) -> &mut Self::BusDevice
[src]
fn bus_device_ref(&self) -> &Self::BusDevice
[src]
fn into_bus_device(self) -> Self::BusDevice
[src]
fn reset<C: Cpu>(&mut self, cpu: &mut C, hard: bool)
[src]
fn nmi<C: Cpu>(&mut self, cpu: &mut C) -> bool
[src]
fn execute_next_frame<C: Cpu>(&mut self, cpu: &mut C)
[src]
fn ensure_next_frame(&mut self)
[src]
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<(), ()>
impl<M, B, X, V> ControlUnit for Ula<M, B, X, V> where
M: ZxMemory,
B: BusDevice,
B::Timestamp: From<VFrameTs<V>>,
X: MemoryExtension,
V: VideoFrame,
[src]
M: ZxMemory,
B: BusDevice,
B::Timestamp: From<VFrameTs<V>>,
X: MemoryExtension,
V: VideoFrame,
type BusDevice = B
fn bus_device_mut(&mut self) -> &mut Self::BusDevice
[src]
fn bus_device_ref(&self) -> &Self::BusDevice
[src]
fn into_bus_device(self) -> Self::BusDevice
[src]
fn reset<C: Cpu>(&mut self, cpu: &mut C, hard: bool)
[src]
fn nmi<C: Cpu>(&mut self, cpu: &mut C) -> bool
[src]
fn execute_next_frame<C: Cpu>(&mut self, cpu: &mut C)
[src]
fn ensure_next_frame(&mut self)
[src]
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<(), ()>
impl<P: AyPortDecode> ControlUnit for AyPlayer<P>
[src]
type BusDevice = NullDevice<FTs>
fn bus_device_mut(&mut self) -> &mut Self::BusDevice
[src]
fn bus_device_ref(&self) -> &Self::BusDevice
[src]
fn into_bus_device(self) -> Self::BusDevice
[src]
fn reset<C: Cpu>(&mut self, cpu: &mut C, hard: bool)
[src]
fn nmi<C: Cpu>(&mut self, cpu: &mut C) -> bool
[src]
fn execute_next_frame<C: Cpu>(&mut self, cpu: &mut C)
[src]
fn ensure_next_frame(&mut self)
[src]
fn execute_single_step<C: Cpu, F>(
&mut self,
cpu: &mut C,
debug: Option<F>
) -> Result<(), ()> where
F: FnOnce(CpuDebug),
[src]
&mut self,
cpu: &mut C,
debug: Option<F>
) -> Result<(), ()> where
F: FnOnce(CpuDebug),
impl<U, B, X> ControlUnit for UlaPlus<U> where
U: for<'a> UlaPlusInner<'a> + ControlUnit<BusDevice = B> + UlaControlExt + MemoryAccess<MemoryExt = X> + Memory<Timestamp = VideoTs> + Io<Timestamp = VideoTs, WrIoBreak = (), RetiBreak = ()>,
B: BusDevice,
B::Timestamp: From<VFrameTs<U::VideoFrame>>,
X: MemoryExtension,
[src]
U: for<'a> UlaPlusInner<'a> + ControlUnit<BusDevice = B> + UlaControlExt + MemoryAccess<MemoryExt = X> + Memory<Timestamp = VideoTs> + Io<Timestamp = VideoTs, WrIoBreak = (), RetiBreak = ()>,
B: BusDevice,
B::Timestamp: From<VFrameTs<U::VideoFrame>>,
X: MemoryExtension,
type BusDevice = U::BusDevice
fn bus_device_mut(&mut self) -> &mut Self::BusDevice
[src]
fn bus_device_ref(&self) -> &Self::BusDevice
[src]
fn into_bus_device(self) -> Self::BusDevice
[src]
fn reset<C: Cpu>(&mut self, cpu: &mut C, hard: bool)
[src]
fn nmi<C: Cpu>(&mut self, cpu: &mut C) -> bool
[src]
fn execute_next_frame<C: Cpu>(&mut self, cpu: &mut C)
[src]
fn ensure_next_frame(&mut self)
[src]
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<(), ()>