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>
Source§type Limit = i16
type Limit = i16
limit
argument when executing
instructions. See Cpu::execute_with_limit for an explanation.Source§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.Source§fn add_no_mreq(&mut self, address: u16, add_ts: NonZeroU8)
fn add_no_mreq(&mut self, address: u16, add_ts: NonZeroU8)
add_ts
.
It’s being used by internal operations of the Cpu without any external access.
The address
given here is whatever was put on the address bus before.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.Source§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,Source§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.Source§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.Source§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§const fn clone_from(&mut self, source: &Self)
const 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: PartialOrd, C: PartialOrd> PartialOrd for VFrameTsCounter<V, C>
impl<V: PartialOrd, C: PartialOrd> PartialOrd for VFrameTsCounter<V, C>
Source§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 moreimpl<V: Copy, C: Copy> Copy for VFrameTsCounter<V, C>
impl<V: Eq, C: Eq> Eq for VFrameTsCounter<V, C>
impl<V, C> StructuralPartialEq for VFrameTsCounter<V, C>
Auto Trait Implementations§
impl<V, C> Freeze for VFrameTsCounter<V, C>where
C: Freeze,
impl<V, C> RefUnwindSafe for VFrameTsCounter<V, C>where
C: RefUnwindSafe,
V: RefUnwindSafe,
impl<V, C> Send for VFrameTsCounter<V, C>
impl<V, C> Sync for VFrameTsCounter<V, C>
impl<V, C> Unpin for VFrameTsCounter<V, C>
impl<V, C> UnwindSafe for VFrameTsCounter<V, C>where
C: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
.