1
0
mirror of https://github.com/mre/mos6502.git synced 2024-11-25 02:33:26 +00:00

Initial version

This commit is contained in:
Matthias Endler 2018-11-04 23:11:41 +01:00 committed by Matthias
parent fdf71425d3
commit 4dd69194ce
3 changed files with 46 additions and 0 deletions

Binary file not shown.

1
test-roms/SOURCES.md Normal file
View File

@ -0,0 +1 @@
`6502_functional_test.bin` from https://github.com/Klaus2m5/6502_65C02_functional_tests

45
tests/functional-test.rs Normal file
View File

@ -0,0 +1,45 @@
extern crate mos6502;
use std::fs::File;
use std::io::Read;
use mos6502::address::Address;
use mos6502::cpu::CPU;
const PC_START: u16 = 0x400;
// const MAX_CYCLES: usize = 100000000;
#[test]
fn functional_test() {
let mut f = File::open("test-roms/6502_functional_test.bin").unwrap();
let mut rom = Vec::<u8>::new();
f.read_to_end(&mut rom).unwrap();
let mut cpu = CPU::new();
cpu.memory.set_bytes(Address(PC_START), &rom);
cpu.run();
/*
let mut last_pc = PC_START;
loop {
cpu.step();
// Prevent endless loop
if cpu.interconnect.elapsed_cycles() > MAX_CYCLES {
assert!(false, "Took too many cycles to complete");
}
if last_pc == cpu.registers.pc {
if cpu.registers.pc == 0x3367 {
// Success!
break;
} else {
assert!(false, "Trap detected");
}
}
last_pc = cpu.registers.pc;
}
*/
}