pub trait SerialPortDevice {
    type Timestamp: Sized;

    fn write_data(
        &mut self,
        rxd: DataState,
        timestamp: Self::Timestamp
    ) -> ControlState; fn poll_ready(&mut self, timestamp: Self::Timestamp) -> ControlState; fn update_cts(&mut self, cts: ControlState, timestamp: Self::Timestamp); fn read_data(&mut self, timestamp: Self::Timestamp) -> DataState; fn next_frame(&mut self, eof_timestamp: Self::Timestamp); }
Expand description

An interface for emulating communication between a ZX Spectrum’s hardware port and remote devices.

Emulators of peripheral devices should implement this trait.

Methods of this trait are being called by bus devices implementing serial port communication.

Required Associated Types§

Required Methods§

A device receives a current RxD state from Spectrum and should output a DTR line state.

This method is being called when a CPU writes (OUT) to a port and only when the CTS line isn’t changed by the write.

This method is being called once every frame, near the end of it, and should return a DTR line state.

Receives an updated CTS line state.

This method is being called when a CPU writes (OUT) to a port and only when the value of CTS changes.

Should return a TxD line state.

This method is being called when a CPU reads (IN) from a port.

Called when the current frame ends to allow emulators to wrap stored timestamps.

Implementors§