[][src]Trait emulator_6502::Interface6502

pub trait Interface6502 {
    fn read(&mut self, address: u16) -> u8;
fn write(&mut self, address: u16, data: u8); }

Trait for interfacing with the 6502

Declaration Example

This example is not tested
struct BasicRam{
   ram: Box<[u8; u16::max_value() as usize + 1]> //The maximum address range of the 6502
}

impl BasicRam {
   fn load_program(&mut self, start: usize, data: &mut Vec<u8>){
       self.ram[start..].clone_from_slice(data);
   }
}

impl Interface6502 for BasicRam{
   fn read(&mut self, address: u16) -> u8{
       self.ram[address as usize]
   }

   fn write(&mut self, address: u16, data: u8){
       self.ram[address as usize] = data
   }
}

Required methods

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

fn write(&mut self, address: u16, data: u8)

Loading content...

Implementors

Loading content...