Simple emulator of the MOS 6502 CPU. I used it to build an Apple-1 emulator.
let mut cpu = mos6502::cpu::CPU::new();
let program = "LDA #$c0
TAX
INX
ADC #$c4";
// you can skip this step,
// if you load an assembled machine code
let bytes = mos6502::asm::assemble(&program);
cpu.load(&bytes, 0x800);
cpu.run();
Run tests:
cargo test
You can download functional tests from this repository.
Put the 6502_functional_test.bin
file to the root of the repository and then run:
wget "https://github.com/Klaus2m5/6502_65C02_functional_tests/blob/master/bin_files/6502_functional_test.bin?raw=true" -O 6502_functional_test.bin
make functional-tests