Struct spectrusty::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 new(vc: i16, hc: i16, contention: C) -> VFrameTsCounter<V, C>
pub fn new(vc: i16, hc: i16, contention: C) -> VFrameTsCounter<V, C>
sourcepub fn from_tstates(ts: i32, contention: C) -> VFrameTsCounter<V, C>
pub fn from_tstates(ts: i32, contention: C) -> VFrameTsCounter<V, C>
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) -> VFrameTsCounter<V, C>
pub fn from_video_ts(vts: VideoTs, contention: C) -> VFrameTsCounter<V, C>
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) -> VFrameTsCounter<V, C>
pub fn from_vframe_ts(vfts: VFrameTs<V>, contention: C) -> VFrameTsCounter<V, C>
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> = VFrameTs{ ts: VideoTs{ vc: V::VSL_COUNT, hc: 0,}, _vframe: PhantomData,}
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, C> AddAssign<u32> for VFrameTsCounter<V, C>where
V: VideoFrame,
impl<V, C> AddAssign<u32> for VFrameTsCounter<V, C>where
V: VideoFrame,
source§fn add_assign(&mut self, delta: u32)
fn add_assign(&mut self, delta: u32)
+=
operation. Read moresource§impl<V, C> Clock for VFrameTsCounter<V, C>where
V: VideoFrame,
C: MemoryContention,
impl<V, C> Clock for VFrameTsCounter<V, C>where
V: VideoFrame,
C: MemoryContention,
§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: <VFrameTsCounter<V, C> as Clock>::Limit) -> bool
fn is_past_limit(&self, limit: <VFrameTsCounter<V, C> as Clock>::Limit) -> bool
true
if the [Clock] has reached the given limit
otherwise should return false
.source§fn add_irq(&mut self, _pc: u16) -> <VFrameTsCounter<V, C> as Clock>::Timestamp
fn add_irq(&mut self, _pc: u16) -> <VFrameTsCounter<V, C> as Clock>::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) -> <VFrameTsCounter<V, C> as Clock>::Timestamp
fn add_m1(&mut self, address: u16) -> <VFrameTsCounter<V, C> as Clock>::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
) -> <VFrameTsCounter<V, C> as Clock>::Timestamp
fn add_mreq(
&mut self,
address: u16
) -> <VFrameTsCounter<V, C> as Clock>::Timestamp
3
and should return the timestamp that may be passed to [Memory::read_mem], Read moresource§fn add_io(&mut self, port: u16) -> <VFrameTsCounter<V, C> as Clock>::Timestamp
fn add_io(&mut self, port: u16) -> <VFrameTsCounter<V, C> as Clock>::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) -> <VFrameTsCounter<V, C> as Clock>::Timestamp
fn as_timestamp(&self) -> <VFrameTsCounter<V, C> as Clock>::Timestamp
source§impl<V, C> Clone for VFrameTsCounter<V, C>where
V: Clone,
C: Clone,
impl<V, C> Clone for VFrameTsCounter<V, C>where
V: Clone,
C: Clone,
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, C> Ord for VFrameTsCounter<V, C>where
V: Ord,
C: Ord,
impl<V, C> Ord for VFrameTsCounter<V, C>where
V: Ord,
C: Ord,
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, C> PartialEq<VFrameTsCounter<V, C>> for VFrameTsCounter<V, C>where
V: PartialEq<V>,
C: PartialEq<C>,
impl<V, C> PartialEq<VFrameTsCounter<V, C>> for VFrameTsCounter<V, C>where
V: PartialEq<V>,
C: PartialEq<C>,
source§fn eq(&self, other: &VFrameTsCounter<V, C>) -> bool
fn eq(&self, other: &VFrameTsCounter<V, C>) -> bool
source§impl<V, C> PartialOrd<VFrameTsCounter<V, C>> for VFrameTsCounter<V, C>where
V: PartialOrd<V>,
C: PartialOrd<C>,
impl<V, C> PartialOrd<VFrameTsCounter<V, C>> for VFrameTsCounter<V, C>where
V: PartialOrd<V>,
C: PartialOrd<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, C> SubAssign<u32> for VFrameTsCounter<V, C>where
V: VideoFrame,
impl<V, C> SubAssign<u32> for VFrameTsCounter<V, C>where
V: VideoFrame,
source§fn sub_assign(&mut self, delta: u32)
fn sub_assign(&mut self, delta: u32)
-=
operation. Read moreimpl<V, C> Copy for VFrameTsCounter<V, C>where
V: Copy,
C: Copy,
impl<V, C> Eq for VFrameTsCounter<V, C>where
V: Eq,
C: Eq,
impl<V, C> StructuralEq for VFrameTsCounter<V, C>
impl<V, C> StructuralPartialEq for VFrameTsCounter<V, C>
Auto Trait Implementations§
impl<V, C> RefUnwindSafe for VFrameTsCounter<V, C>where
C: RefUnwindSafe,
V: RefUnwindSafe,
impl<V, C> Send for VFrameTsCounter<V, C>where
C: Send,
V: Send,
impl<V, C> Sync for VFrameTsCounter<V, C>where
C: Sync,
V: Sync,
impl<V, C> Unpin for VFrameTsCounter<V, C>where
C: Unpin,
V: Unpin,
impl<V, C> UnwindSafe for VFrameTsCounter<V, C>where
C: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
source§impl<S, T> IntoSample<S> for Twhere
S: FromSample<T>,
impl<S, T> IntoSample<S> for Twhere
S: FromSample<T>,
source§fn into_sample(self) -> S
fn into_sample(self) -> S
S
a sample type from self
.§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read more§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read more§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read more§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more