Struct spectrusty::peripherals::bus::ay::serial128::SerialPorts128
source · pub struct SerialPorts128<S1, S2> {
pub serial1: S1,
pub serial2: S2,
/* private fields */
}
Expand description
The bridge between ZX Spectrum 128 AY-3-8912 I/O ports and emulators of serial port devices.
The RS232C/MIDI interface is implemented using the Port A
Data Store in the sound generator chip IC32.
The data store is a special register that accesses an 8-bit bi-directional port A7-AO.
The port occupies the same I/O space as the sound generator registers and is accessed in much the same way.
Bits of an I/O port A
register have the following meaning:
- A0:
KEYPAD CTS
(OUT) = 0: active - Spectrum ready to receive, 1: inactive - busy. - A1:
KEYPAD RXD
(OUT) = 0: transmit bit (high voltage), 1: transmit bit (low voltage). - A2:
RS232 CTS
(OUT) = 0: active - Spectrum ready to receive, 1: inactive - busy. - A3:
RS232 RXD
(OUT) = 0: transmit (high voltage), 1: transmit bit (low voltage). - A4:
KEYPAD DTR
(IN) = 0: active - a device ready for data, 1: inactive - busy. - A5:
KEYPAD TXD
(IN) = 0: receive bit (high voltage), 1: Receive bit (low voltage). - A6:
RS232 DTR
(IN) = 0: active - a device ready for data, 1: inactive - busy. - A7:
RS232 TXD
(IN) = 0: receive bit (high voltage), 1: Receive bit (low voltage).
This type implements a single AyIoPort as two serial ports of ZX Spectrum 128.
One of these ports is primarily being used for the extension keypad and the other for communicating with a serial printer or another RS-232 device in either direction.
To “connect” something to these ports, provide some types that implement SerialPortDevice as
S1
and S2
.
Fields§
§serial1: S1
A SerialPortDevice connected to a KEYPAD
port.
serial2: S2
A SerialPortDevice connected to a RS232
port.
Trait Implementations§
source§impl<S1, S2> AyIoPort for SerialPorts128<S1, S2>where
S1: SerialPortDevice,
S2: SerialPortDevice<Timestamp = <S1 as SerialPortDevice>::Timestamp>,
<S1 as SerialPortDevice>::Timestamp: Copy,
impl<S1, S2> AyIoPort for SerialPorts128<S1, S2>where
S1: SerialPortDevice,
S2: SerialPortDevice<Timestamp = <S1 as SerialPortDevice>::Timestamp>,
<S1 as SerialPortDevice>::Timestamp: Copy,
type Timestamp = <S1 as SerialPortDevice>::Timestamp
source§fn ay_io_reset(
&mut self,
_timestamp: <SerialPorts128<S1, S2> as AyIoPort>::Timestamp
)
fn ay_io_reset(
&mut self,
_timestamp: <SerialPorts128<S1, S2> as AyIoPort>::Timestamp
)
timestamp
.source§fn ay_io_write(
&mut self,
_addr: u16,
data: u8,
timestamp: <SerialPorts128<S1, S2> as AyIoPort>::Timestamp
)
fn ay_io_write(
&mut self,
_addr: u16,
data: u8,
timestamp: <SerialPorts128<S1, S2> as AyIoPort>::Timestamp
)
timestamp
.source§fn ay_io_read(
&mut self,
_addr: u16,
timestamp: <SerialPorts128<S1, S2> as AyIoPort>::Timestamp
) -> u8
fn ay_io_read(
&mut self,
_addr: u16,
timestamp: <SerialPorts128<S1, S2> as AyIoPort>::Timestamp
) -> u8
timestamp
.source§impl<S1, S2> Clone for SerialPorts128<S1, S2>where
S1: Clone,
S2: Clone,
impl<S1, S2> Clone for SerialPorts128<S1, S2>where
S1: Clone,
S2: Clone,
source§fn clone(&self) -> SerialPorts128<S1, S2>
fn clone(&self) -> SerialPorts128<S1, S2>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<S1, S2> Default for SerialPorts128<S1, S2>where
S1: Default,
S2: Default,
impl<S1, S2> Default for SerialPorts128<S1, S2>where
S1: Default,
S2: Default,
source§fn default() -> SerialPorts128<S1, S2>
fn default() -> SerialPorts128<S1, S2>
source§impl<'de, S1, S2> Deserialize<'de> for SerialPorts128<S1, S2>where
S1: Deserialize<'de> + Default,
S2: Deserialize<'de> + Default,
impl<'de, S1, S2> Deserialize<'de> for SerialPorts128<S1, S2>where
S1: Deserialize<'de> + Default,
S2: Deserialize<'de> + Default,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<SerialPorts128<S1, S2>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<SerialPorts128<S1, S2>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<S1, S2> Serialize for SerialPorts128<S1, S2>where
S1: Serialize,
S2: Serialize,
impl<S1, S2> Serialize for SerialPorts128<S1, S2>where
S1: Serialize,
S2: 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<S1, S2> RefUnwindSafe for SerialPorts128<S1, S2>where
S1: RefUnwindSafe,
S2: RefUnwindSafe,
impl<S1, S2> Send for SerialPorts128<S1, S2>where
S1: Send,
S2: Send,
impl<S1, S2> Sync for SerialPorts128<S1, S2>where
S1: Sync,
S2: Sync,
impl<S1, S2> Unpin for SerialPorts128<S1, S2>where
S1: Unpin,
S2: Unpin,
impl<S1, S2> UnwindSafe for SerialPorts128<S1, S2>where
S1: UnwindSafe,
S2: 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