Struct spectrusty::peripherals::ay::Ay3_891xIo
source · pub struct Ay3_891xIo<T, R, A, B> {
pub recorder: R,
pub port_a: A,
pub port_b: B,
/* private fields */
}
Expand description
Implements a communication protocol with programmable sound generator AY-3-8910 / 8912 / 8913 and its I/O ports.
Records values written to audio registers which can be used to produce sound using audio::Ay3_891xAudio.
The recorder
type R
needs to implement AyRegRecorder trait.
The port types A
and B
need to implement AyIoPort trait.
Fields§
§recorder: R
Provides access to the recorded changes of sound generator registers. The changes are required to generate sound with audio::Ay3_891xAudio.
port_a: A
An instance of port A
AyIoPort I/O device implementation.
port_b: B
An instance of port B
AyIoPort I/O device implementation.
Implementations§
source§impl<T, R, A, B> Ay3_891xIo<T, R, A, B>where
A: AyIoPort<Timestamp = T>,
B: AyIoPort<Timestamp = T>,
R: AyRegRecorder<Timestamp = T>,
impl<T, R, A, B> Ay3_891xIo<T, R, A, B>where
A: AyIoPort<Timestamp = T>,
B: AyIoPort<Timestamp = T>,
R: AyRegRecorder<Timestamp = T>,
sourcepub fn reset(&mut self, timestamp: T)where
T: Copy,
pub fn reset(&mut self, timestamp: T)where
T: Copy,
Resets the state of internal registers, port devices, and which register is being currently selected for reading and writing.
NOTE: does nothing to the recorded register changes.
sourcepub fn next_frame(&mut self, timestamp: T)where
T: Copy,
pub fn next_frame(&mut self, timestamp: T)where
T: Copy,
Clears recorder data and forwards the call to I/O port implementations. It can be used to indicate an end-of-frame.
sourcepub fn get(&self, reg: AyRegister) -> u8
pub fn get(&self, reg: AyRegister) -> u8
Retrieves a current value of the indicated register.
sourcepub fn registers(&self) -> &[u8; 16]
pub fn registers(&self) -> &[u8; 16]
Returns a reference to all registers as an array of their current values.
sourcepub fn iter_regs(&self) -> impl Iterator<Item = (AyRegister, u8)>
pub fn iter_regs(&self) -> impl Iterator<Item = (AyRegister, u8)>
Returns an iterator of (register, value)
pairs over current registers.
sourcepub fn iter_sound_gen_regs(&self) -> impl Iterator<Item = (AyRegister, u8)>
pub fn iter_sound_gen_regs(&self) -> impl Iterator<Item = (AyRegister, u8)>
Returns an iterator of (register, value)
pairs over current registers used by the
sound generator.
sourcepub fn set(&mut self, reg: AyRegister, val: u8)
pub fn set(&mut self, reg: AyRegister, val: u8)
Sets a current value of the indicated register.
sourcepub fn is_ioa_input(&self) -> bool
pub fn is_ioa_input(&self) -> bool
Returns true
if the control register bit controlling I/O port A
input is reset.
sourcepub fn is_iob_input(&self) -> bool
pub fn is_iob_input(&self) -> bool
Returns true
if the control register bit controlling I/O port B
input is reset.
sourcepub fn is_ioa_output(&self) -> bool
pub fn is_ioa_output(&self) -> bool
Returns true
if the control register bit controlling I/O port A
input is set.
sourcepub fn is_iob_output(&self) -> bool
pub fn is_iob_output(&self) -> bool
Returns true
if the control register bit controlling I/O port B
input is reset.
sourcepub fn selected_register(&self) -> AyRegister
pub fn selected_register(&self) -> AyRegister
Returns a previously selected register with Ay3_891xIo::select_port_write.
sourcepub fn select_port_write(&mut self, data: u8)
pub fn select_port_write(&mut self, data: u8)
Bits 0-3 of data
selects a register to be read from or written to.
This method is being used to interface the host controller I/O operation.
sourcepub fn data_port_write(&mut self, port: u16, data: u8, timestamp: T)
pub fn data_port_write(&mut self, port: u16, data: u8, timestamp: T)
Writes data to a previously selected register and records a change in the attached recorder unless a write is performed to one of the I/O ports.
This method is being used to interface the host controller I/O operation.
sourcepub fn data_port_read(&mut self, port: u16, timestamp: T) -> u8
pub fn data_port_read(&mut self, port: u16, timestamp: T) -> u8
Reads data from a previously selected register.
This method is being used to interface the host controller I/O operation.
Trait Implementations§
source§impl<T, R, A, B> Clone for Ay3_891xIo<T, R, A, B>where
T: Clone,
R: Clone,
A: Clone,
B: Clone,
impl<T, R, A, B> Clone for Ay3_891xIo<T, R, A, B>where
T: Clone,
R: Clone,
A: Clone,
B: Clone,
source§fn clone(&self) -> Ay3_891xIo<T, R, A, B>
fn clone(&self) -> Ay3_891xIo<T, R, A, B>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<T, R, A, B> Debug for Ay3_891xIo<T, R, A, B>where
T: Debug,
R: Debug,
A: Debug,
B: Debug,
impl<T, R, A, B> Debug for Ay3_891xIo<T, R, A, B>where
T: Debug,
R: Debug,
A: Debug,
B: Debug,
source§impl<T, R, A, B> Default for Ay3_891xIo<T, R, A, B>where
T: Default,
R: Default,
A: Default,
B: Default,
impl<T, R, A, B> Default for Ay3_891xIo<T, R, A, B>where
T: Default,
R: Default,
A: Default,
B: Default,
source§fn default() -> Ay3_891xIo<T, R, A, B>
fn default() -> Ay3_891xIo<T, R, A, B>
source§impl<'de, T, R, A, B> Deserialize<'de> for Ay3_891xIo<T, R, A, B>where
A: Deserialize<'de> + Default,
B: Deserialize<'de> + Default,
R: Default,
impl<'de, T, R, A, B> Deserialize<'de> for Ay3_891xIo<T, R, A, B>where
A: Deserialize<'de> + Default,
B: Deserialize<'de> + Default,
R: Default,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Ay3_891xIo<T, R, A, B>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Ay3_891xIo<T, R, A, B>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<T, R, A, B> Serialize for Ay3_891xIo<T, R, A, B>where
A: Serialize,
B: Serialize,
impl<T, R, A, B> Serialize for Ay3_891xIo<T, R, A, B>where
A: Serialize,
B: Serialize,
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl<T, R, A, B> RefUnwindSafe for Ay3_891xIo<T, R, A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, R, A, B> Send for Ay3_891xIo<T, R, A, B>where
A: Send,
B: Send,
R: Send,
T: Send,
impl<T, R, A, B> Sync for Ay3_891xIo<T, R, A, B>where
A: Sync,
B: Sync,
R: Sync,
T: Sync,
impl<T, R, A, B> Unpin for Ay3_891xIo<T, R, A, B>where
A: Unpin,
B: Unpin,
R: Unpin,
T: Unpin,
impl<T, R, A, B> UnwindSafe for Ay3_891xIo<T, R, A, B>where
A: UnwindSafe,
B: UnwindSafe,
R: UnwindSafe,
T: 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