tests: Update tests for memory being CPU-internal
This commit is contained in:
parent
cb69af048f
commit
8b4d5be49d
@ -704,7 +704,7 @@ mod io {
|
|||||||
ScreenTest {
|
ScreenTest {
|
||||||
program: include_bytes!("../../chip-8/IBM Logo.ch8"),
|
program: include_bytes!("../../chip-8/IBM Logo.ch8"),
|
||||||
screen: include_bytes!("tests/screens/IBM Logo.ch8/20.bin"),
|
screen: include_bytes!("tests/screens/IBM Logo.ch8/20.bin"),
|
||||||
steps: 56,
|
steps: 21,
|
||||||
quirks: Quirks {
|
quirks: Quirks {
|
||||||
bin_ops: false,
|
bin_ops: false,
|
||||||
shift: false,
|
shift: false,
|
||||||
@ -1151,7 +1151,7 @@ mod behavior {
|
|||||||
cpu.pc = 0xfff;
|
cpu.pc = 0xfff;
|
||||||
match cpu.tick(&mut bus) {
|
match cpu.tick(&mut bus) {
|
||||||
Err(Error::InvalidAddressRange { range }) => {
|
Err(Error::InvalidAddressRange { range }) => {
|
||||||
eprintln!("InvalidBusRange {{ {range:04x?} }}")
|
eprintln!("InvalidAddressRange {{ {range:04x?} }}")
|
||||||
}
|
}
|
||||||
other => unreachable!("{other:04x?}"),
|
other => unreachable!("{other:04x?}"),
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,8 @@ fn setup_environment() -> (CPU, Bus) {
|
|||||||
(
|
(
|
||||||
cpu,
|
cpu,
|
||||||
bus! {
|
bus! {
|
||||||
// Load the charset into ROM
|
|
||||||
Charset [0x0050..0x00A0] = include_bytes!("../src/mem/charset.bin"),
|
|
||||||
// Load the ROM file into RAM
|
|
||||||
Program [0x0200..0x1000],
|
|
||||||
// Create a screen, and fill it with garbage
|
// Create a screen, and fill it with garbage
|
||||||
Screen [0x0F00..0x1000] = b"jsuadhgufywegrwsdyfogbbg4owgbrt",
|
Screen [0x000..0x100] = b"jsuadhgufywegrwsdyfogbbg4owgbrt",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -34,11 +30,14 @@ struct SuiteTest {
|
|||||||
|
|
||||||
fn run_screentest(test: SuiteTest, mut cpu: CPU, mut bus: Bus) {
|
fn run_screentest(test: SuiteTest, mut cpu: CPU, mut bus: Bus) {
|
||||||
// Set the test to run
|
// Set the test to run
|
||||||
bus.write(0x1ffu16, test.test);
|
cpu.poke(0x1ffu16, test.test);
|
||||||
cpu.load_program_bytes(test.data).unwrap();
|
cpu.load_program_bytes(test.data).unwrap();
|
||||||
// The test suite always initiates a keypause on test completion
|
// The test suite always initiates a keypause on test completion
|
||||||
while !(cpu.flags.is_paused()) {
|
while !(cpu.flags.is_paused()) {
|
||||||
cpu.multistep(&mut bus, 10).unwrap();
|
cpu.multistep(&mut bus, 10).unwrap();
|
||||||
|
if cpu.cycle() > 1000000 {
|
||||||
|
panic!("test {} took too long", test.test)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Compare the screen to the reference screen buffer
|
// Compare the screen to the reference screen buffer
|
||||||
bus.print_screen().unwrap();
|
bus.print_screen().unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user