Struct intel_8080_emu::proc_state::Proc8080
source · pub struct Proc8080<Bus: DataBus> { /* private fields */ }
Expand description
Structure containing the processor state (flags, registers and memory) and logic.
Implementations
sourceimpl<Bus: DataBus> Proc8080<Bus>
impl<Bus: DataBus> Proc8080<Bus>
sourcepub fn new(mem: Box<[u8]>, data_bus: Bus) -> Proc8080<Bus>
pub fn new(mem: Box<[u8]>, data_bus: Bus) -> Proc8080<Bus>
Builds a new Proc8080
with the given memory mem
and DataBus
.
The memory contains both the ROM and RAM of the processor. Usually it is called with a boxed array of size 0xffff (adressable space for the intel 8080) which contains the ROM at the beginning of the memory. The processor starts with the program counter equal to 0.
The data_bus
contains callbacks called when running a IN
or OUT
opcode.
sourcepub fn emulate(&mut self)
pub fn emulate(&mut self)
Reads the next opcode in memory and changes state accordingly.
This methods run one step
of the processor simulation. It reads the next opcode according
to the program counter
sourcepub fn interrupt(&mut self, rst_value: u8)
pub fn interrupt(&mut self, rst_value: u8)
Make the processor run a RST
instruction.
There are 8 possible RST
instruction for the 8080 (RST 0
to 7
). The specific
instruction is chosen via rst_value
.
An interrupt restart a processor which was in stopped state after running a HLT opcode.
Panics
If rst_value
is greater than 7;