Expand description
§emu6809-core
A Motorola 6809 CPU emulator core.
Provides a Cpu that executes 6809 instructions against any
memory system implementing the Bus trait.
§Example
use mc6809_core::{Cpu, Bus};
struct FlatRam([u8; 65536]);
impl Bus for FlatRam {
fn read(&mut self, addr: u16) -> u8 { self.0[addr as usize] }
fn write(&mut self, addr: u16, val: u8) { self.0[addr as usize] = val; }
}
let mut bus = FlatRam([0; 65536]);
// Place a reset vector pointing to 0x0400
bus.0[0xFFFE] = 0x04;
bus.0[0xFFFF] = 0x00;
// Place a NOP at 0x0400
bus.0[0x0400] = 0x12;
let mut cpu = Cpu::new();
cpu.reset(&mut bus);
assert_eq!(cpu.reg.pc, 0x0400);
cpu.step(&mut bus);
assert_eq!(cpu.reg.pc, 0x0401);Re-exports§
pub use bus::Bus;pub use bus::BusSignals;pub use registers::ConditionCodes;pub use registers::Registers;
Modules§
- addressing
- Indexed addressing mode decoder for the 6809.
- alu
- ALU (Arithmetic Logic Unit) helpers for the 6809.
- bus
- registers
Structs§
- Cpu
- Motorola 6809 CPU emulator.