Struct spectrusty_core::clock::VFrameTsCounter
source · pub struct VFrameTsCounter<V, C> {
pub vts: VFrameTs<V>,
pub contention: C,
}
Expand description
A generic VFrameTs<V>
based T-states counter.
Implements Clock for counting cycles when code is being executed by z80emu::Cpu.
Inserts additional T-states according to the contention model specified by generic
parameters: V:
VideoFrame and C:
MemoryContention.
Fields§
§vts: VFrameTs<V>
The current value of the counter.
contention: C
An instance implementing a MemoryContention trait.
Implementations§
source§impl<V, C> VFrameTsCounter<V, C>where
V: VideoFrame,
C: MemoryContention,
impl<V, C> VFrameTsCounter<V, C>where
V: VideoFrame,
C: MemoryContention,
sourcepub fn from_tstates(ts: FTs, contention: C) -> Self
pub fn from_tstates(ts: FTs, contention: C) -> Self
Builds a normalized VFrameTsCounter from the given count of T-states.
Panics
Panics when the given ts
overflows the capacity of VideoTs.
sourcepub fn from_video_ts(vts: VideoTs, contention: C) -> Self
pub fn from_video_ts(vts: VideoTs, contention: C) -> Self
Builds a normalized VFrameTsCounter from the given count of T-states.
Panics
Panics when the given ts
overflows the capacity of VideoTs.
sourcepub fn from_vframe_ts(vfts: VFrameTs<V>, contention: C) -> Self
pub fn from_vframe_ts(vfts: VFrameTs<V>, contention: C) -> Self
Builds a normalized VFrameTsCounter from the given count of T-states.
Panics
Panics when the given ts
overflows the capacity of VideoTs.
pub fn is_contended_address(self, address: u16) -> bool
Methods from Deref<Target = VFrameTs<V>>§
pub const EOF: VFrameTs<V> = _
sourcepub fn wrap_frame(&mut self)
pub fn wrap_frame(&mut self)
Ensures the vertical counter is in the range: (-VSL_COUNT, VSL_COUNT)
by calculating
a remainder of the division of the vertical counter by VideoFrame::VSL_COUNT.
Trait Implementations§
source§impl<V: VideoFrame, C> AddAssign<u32> for VFrameTsCounter<V, C>
impl<V: VideoFrame, C> AddAssign<u32> for VFrameTsCounter<V, C>
source§fn add_assign(&mut self, delta: u32)
fn add_assign(&mut self, delta: u32)
+=
operation. Read moresource§impl<V: VideoFrame, C: MemoryContention> Clock for VFrameTsCounter<V, C>
impl<V: VideoFrame, C: MemoryContention> Clock for VFrameTsCounter<V, C>
§type Limit = i16
type Limit = i16
limit
argument when executing
instructions. See Cpu::execute_with_limit for an explanation. Read moresource§fn is_past_limit(&self, limit: Self::Limit) -> bool
fn is_past_limit(&self, limit: Self::Limit) -> bool
source§fn add_irq(&mut self, _pc: u16) -> Self::Timestamp
fn add_irq(&mut self, _pc: u16) -> Self::Timestamp
6
T-states.
The method should return the timestamp that may be passed to Io::irq_data.
It’s being used at the beginning of the maskable interrupt request/acknowledge cycle.
The pc
is a value of the program counter when the interrupt was accepted. Read moresource§fn add_no_mreq(&mut self, address: u16, add_ts: NonZeroU8)
fn add_no_mreq(&mut self, address: u16, add_ts: NonZeroU8)
source§fn add_m1(&mut self, address: u16) -> Self::Timestamp
fn add_m1(&mut self, address: u16) -> Self::Timestamp
4
and should return the timestamp that may be passed to Memory::read_opcode.
This method is also being used when the non-maskable interrupt is being accepted and while the
Cpu
is wasting cycles in the halted
state. Read moresource§fn add_mreq(&mut self, address: u16) -> Self::Timestamp
fn add_mreq(&mut self, address: u16) -> Self::Timestamp
3
and should return the timestamp that may be passed to Memory::read_mem, Read moresource§fn add_io(&mut self, port: u16) -> Self::Timestamp
fn add_io(&mut self, port: u16) -> Self::Timestamp
4
T-states
and should return the timestamp that may be passed to Io::read_io or Io::write_io. Read moresource§fn add_wait_states(&mut self, _bus: u16, wait_states: NonZeroU16)
fn add_wait_states(&mut self, _bus: u16, wait_states: NonZeroU16)
wait_states
.
A call to one of Io::read_io, Io::write_io or Io::irq_data may request such additional
number of wait states to be added. Read moresource§fn as_timestamp(&self) -> Self::Timestamp
fn as_timestamp(&self) -> Self::Timestamp
source§impl<V: Clone, C: Clone> Clone for VFrameTsCounter<V, C>
impl<V: Clone, C: Clone> Clone for VFrameTsCounter<V, C>
source§fn clone(&self) -> VFrameTsCounter<V, C>
fn clone(&self) -> VFrameTsCounter<V, C>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<V, C> Deref for VFrameTsCounter<V, C>
impl<V, C> Deref for VFrameTsCounter<V, C>
source§impl<V, C> DerefMut for VFrameTsCounter<V, C>
impl<V, C> DerefMut for VFrameTsCounter<V, C>
source§impl<V, C> From<VFrameTsCounter<V, C>> for VFrameTs<V>
impl<V, C> From<VFrameTsCounter<V, C>> for VFrameTs<V>
source§fn from(vftsc: VFrameTsCounter<V, C>) -> VFrameTs<V>
fn from(vftsc: VFrameTsCounter<V, C>) -> VFrameTs<V>
source§impl<V, C> From<VFrameTsCounter<V, C>> for VideoTs
impl<V, C> From<VFrameTsCounter<V, C>> for VideoTs
source§fn from(vftsc: VFrameTsCounter<V, C>) -> VideoTs
fn from(vftsc: VFrameTsCounter<V, C>) -> VideoTs
source§impl<V: Ord, C: Ord> Ord for VFrameTsCounter<V, C>
impl<V: Ord, C: Ord> Ord for VFrameTsCounter<V, C>
source§fn cmp(&self, other: &VFrameTsCounter<V, C>) -> Ordering
fn cmp(&self, other: &VFrameTsCounter<V, C>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<V: PartialEq, C: PartialEq> PartialEq<VFrameTsCounter<V, C>> for VFrameTsCounter<V, C>
impl<V: PartialEq, C: PartialEq> PartialEq<VFrameTsCounter<V, C>> for VFrameTsCounter<V, C>
source§fn eq(&self, other: &VFrameTsCounter<V, C>) -> bool
fn eq(&self, other: &VFrameTsCounter<V, C>) -> bool
source§impl<V: PartialOrd, C: PartialOrd> PartialOrd<VFrameTsCounter<V, C>> for VFrameTsCounter<V, C>
impl<V: PartialOrd, C: PartialOrd> PartialOrd<VFrameTsCounter<V, C>> for VFrameTsCounter<V, C>
source§fn partial_cmp(&self, other: &VFrameTsCounter<V, C>) -> Option<Ordering>
fn partial_cmp(&self, other: &VFrameTsCounter<V, C>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<V: VideoFrame, C> SubAssign<u32> for VFrameTsCounter<V, C>
impl<V: VideoFrame, C> SubAssign<u32> for VFrameTsCounter<V, C>
source§fn sub_assign(&mut self, delta: u32)
fn sub_assign(&mut self, delta: u32)
-=
operation. Read more