monistode_emulator/
common.rs

1use monistode_binutils::Executable;
2
3pub trait Processor<Byte, Pc, IOPort, IOItem> {
4    fn next(&mut self) -> Byte;
5    fn at_pc_plus(&self, offset: u16) -> Byte;
6    fn pc(&self) -> Pc;
7    fn run_command<T, U>(&mut self, output: T, input: U) -> ProcessorContinue
8    where
9        T: Fn(IOPort, IOItem),
10        U: Fn(IOPort) -> IOItem;
11    fn load_executable(&mut self, executable: &Executable) -> Result<(), String>;
12    fn peek_stack(&mut self, n: u8) -> u16;
13}
14
15pub enum ProcessorContinue {
16    KeepRunning,
17    Error,
18    Halt,
19}