Trait iz80::Machine

source ·
pub trait Machine {
    // Required methods
    fn peek(&self, address: u16) -> u8;
    fn poke(&mut self, address: u16, value: u8);
    fn port_in(&mut self, address: u16) -> u8;
    fn port_out(&mut self, address: u16, value: u8);

    // Provided methods
    fn peek16(&self, address: u16) -> u16 { ... }
    fn poke16(&mut self, address: u16, value: u16) { ... }
}
Expand description

Abstraction of the device hosting the Z80 CPU

The device hosting the CPU has to provide implementations of the memory and port access. A simple implementation is provided with PlainMachine

Required Methods§

source

fn peek(&self, address: u16) -> u8

Returns the memory contents in [address]

source

fn poke(&mut self, address: u16, value: u8)

Sets the memory content to [value] in [address]

source

fn port_in(&mut self, address: u16) -> u8

Port in, from the device to the CPU. Returns the port value in the hosting device.

source

fn port_out(&mut self, address: u16, value: u8)

Port out, from the CPU to the device. Sets a port value on the hosting device.

Provided Methods§

source

fn peek16(&self, address: u16) -> u16

Returns the memory contents in [address] as word

source

fn poke16(&mut self, address: u16, value: u16)

Sets the memory content to the word [value] in [address]

Implementors§