1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
/// Emulates terminal. It holds input/output data in buffer
/// transferred to/from `Emulator`.
pub trait Terminal {
	/// Puts an output ascii byte data to output buffer.
	/// The data is expected to be read by user program via `get_output()`
	/// and be displayed to user.
	fn put_byte(&mut self, value: u8);

	/// Gets an output ascii byte data from output buffer.
	/// This method returns zero if the buffer is empty.
	fn get_output(&mut self) -> u8;

	/// Puts an input ascii byte data to input buffer.
	/// The data is expected to be read by `Emulator` via `get_input()`
	/// and be handled.
	fn put_input(&mut self, data: u8);

	/// Gets an input ascii byte data from input buffer.
	/// Used by `Emulator`.
	fn get_input(&mut self) -> u8;
}