[][src]Trait spectrusty::chip::ControlUnit

pub trait ControlUnit {
    type BusDevice: BusDevice;
    pub fn bus_device_mut(&mut self) -> &mut Self::BusDevice;
pub fn bus_device_ref(&self) -> &Self::BusDevice;
pub fn into_bus_device(self) -> Self::BusDevice;
pub fn reset<C>(&mut self, cpu: &mut C, hard: bool)
    where
        C: Cpu
;
pub fn nmi<C>(&mut self, cpu: &mut C) -> bool
    where
        C: Cpu
;
pub fn execute_next_frame<C>(&mut self, cpu: &mut C)
    where
        C: Cpu
;
pub fn ensure_next_frame(&mut self);
pub fn execute_single_step<C, F>(
        &mut self,
        cpu: &mut C,
        debug: Option<F>
    ) -> Result<(), BreakCause<(), ()>>
    where
        C: Cpu,
        F: FnOnce(CpuDebug)
; }

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.

Loading content...

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>(&mut self, cpu: &mut C, hard: bool) where
    C: Cpu, 
[src]

Performs a system reset.

When hard is:

  • true emulates a RESET signal being active for the cpu and all bus devices.
  • false executes a RST 0 instruction on the cpu but without forwarding the clock counter.

In any case, this operation is always instant.

pub fn nmi<C>(&mut self, cpu: &mut C) -> bool where
    C: Cpu, 
[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][crate::z80emu::Cpu::nmi].

pub fn execute_next_frame<C>(&mut self, cpu: &mut C) where
    C: Cpu, 
[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, F>(
    &mut self,
    cpu: &mut C,
    debug: Option<F>
) -> Result<(), BreakCause<(), ()>> where
    C: Cpu,
    F: FnOnce(CpuDebug), 
[src]

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.

Loading content...

Implementors

impl<B, X> ControlUnit for Ula3<B, X> where
    B: BusDevice,
    B::Timestamp: From<VFrameTs<Ula3VidFrame>>,
    X: MemoryExtension
[src]

type BusDevice = B

impl<B, X> ControlUnit for Ula128<B, X> where
    B: BusDevice,
    B::Timestamp: From<VFrameTs<Ula128VidFrame>>,
    X: MemoryExtension
[src]

type BusDevice = B

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]

type BusDevice = B

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]

type BusDevice = B

impl<P: AyPortDecode> ControlUnit for AyPlayer<P>[src]

type BusDevice = NullDevice<FTs>

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]

type BusDevice = U::BusDevice

Loading content...