pub trait ParallelPortDevice {
type Timestamp: Sized;
// Required methods
fn write_data(&mut self, data: u8, timestamp: Self::Timestamp);
fn write_strobe(&mut self, strobe: bool, timestamp: Self::Timestamp) -> bool;
fn poll_busy(&mut self) -> bool;
fn next_frame(&mut self, eof_timestamp: Self::Timestamp);
}Expand description
An interface for emulating communication between a Spectrum’s or other peripherals’ hardware port and remote parallel devices.
Emulators of peripheral devices should implement this trait.
Methods of this trait are being called by bus devices implementing parallel port communication.
Required Associated Types§
Required Methods§
Sourcefn write_data(&mut self, data: u8, timestamp: Self::Timestamp)
fn write_data(&mut self, data: u8, timestamp: Self::Timestamp)
A device receives a byte written to the parallel data port.
Sourcefn write_strobe(&mut self, strobe: bool, timestamp: Self::Timestamp) -> bool
fn write_strobe(&mut self, strobe: bool, timestamp: Self::Timestamp) -> bool
A device receives a changed STROBE bit status.
strobe is true if the STROBE went high, false when it went low.
Should return the BUSY status signal:
trueif theBUSYsignal is high,falsewhen it’s low.
Sourcefn poll_busy(&mut self) -> bool
fn poll_busy(&mut self) -> bool
This method is being called once every frame, near the end of it, and should return a BUSY signal state.
Returns true if the BUSY signal is high, and false when it’s low.
Sourcefn next_frame(&mut self, eof_timestamp: Self::Timestamp)
fn next_frame(&mut self, eof_timestamp: Self::Timestamp)
Called when the current frame ends to allow emulators to wrap stored timestamps.