pub trait ProgramController {
    fn insert_program(&mut self, offset: u16, prog: &str);
    fn set_program(&mut self, offset: u16, prog: &str);
    fn set_interrupt_vectors(&mut self, nmi: u16, irq: u16, brk: u16);
    fn default_interrupt_vectors(&mut self);
    fn execute(&mut self) -> u64;
    fn run(&mut self, duration: Duration) -> (u64, Duration);
    fn fill_stack(&mut self, ops: Vec<u8>);
    fn reset(&mut self);
}
Expand description

Abstraction layer over crate::vm::VirtualMachine

This trait is not strictly adhering to the VM hardware, instead it acts as an abstraction layer to the user for applying and using programs with the VM.

Required Methods

Insert a hex encoded string prog at heap offset offset.

Insert a hex encoded string prog at heap offset offset and set the PC to offset.

Set the interrupt vectors to the given values.

Set the interrupt vectors to the values: (0xFFFA, 0xFFFB), (0xFFFC, 0xFFFD), (0xFFFE, 0xFFFF)

Run the internal program.

Run the internally set program at offset for duration.

Fill the stack with ops.

Reset machine state.

Implementors