Gemma now has a test that runs the IBM Logo and verifies the video is as expected when done.
This commit is contained in:
parent
2ef8a78c32
commit
6f7b894e92
@ -1190,7 +1190,7 @@ mod test {
|
||||
x.registers.poke(0x1, 0x10);
|
||||
x.registers.poke(0x2, 0x08);
|
||||
Chip8CpuInstructions::SubVxVy(0x1, 0x02).execute(&mut x);
|
||||
assert_eq!(x.registers.peek(0xf), 0);
|
||||
assert_eq!(x.registers.peek(0xf), 1);
|
||||
assert_eq!(x.registers.peek(0x1), 0x8);
|
||||
assert_eq!(x.registers.peek_pc(), 0x202);
|
||||
}
|
||||
@ -1249,7 +1249,7 @@ mod test {
|
||||
// expect the result to be 0x0b
|
||||
assert_eq!(x.registers.peek(0x1), 0x0b);
|
||||
// expect the vf register to be set to 1 as there was overflow
|
||||
assert_eq!(x.registers.peek(0xf), 0x0);
|
||||
assert_eq!(x.registers.peek(0xf), 0x1);
|
||||
|
||||
let mut x = Chip8Computer::new();
|
||||
x.registers.poke(0x01, 0xab);
|
||||
@ -1258,7 +1258,7 @@ mod test {
|
||||
|
||||
// expect the result to be 11110101, -0xB, -11, 245, 0xF5
|
||||
assert_eq!(x.registers.peek(0x1), 0xf5);
|
||||
assert_eq!(x.registers.peek(0xf), 0x1);
|
||||
assert_eq!(x.registers.peek(0xf), 0x0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@ -6,11 +6,17 @@ fn smoke() { assert!(true) }
|
||||
#[test]
|
||||
fn test_rom_1_works() {
|
||||
let mut x = Chip8Computer::new();
|
||||
// Load the IBM rom and run it...
|
||||
// Load the IBM rom and run it.
|
||||
// it takes 39 cycles to get to the end so lets run it 40.
|
||||
|
||||
let test_rom_to_run = std::fs::read("../resources/roms/2-ibm-logo.ch8").unwrap();
|
||||
x.load_bytes_to_memory(0x200, test_rom_to_run.into());
|
||||
|
||||
for i in 0..40 {
|
||||
x.step_system();
|
||||
}
|
||||
// ...then verify that the current video memory of the chip-8
|
||||
// simulator matches what we expect it to be
|
||||
|
||||
assert_eq!(x.dump_video_to_string(), );
|
||||
|
||||
assert_eq!(x.dump_video_to_string(), std::fs::read_to_string("../resources/test/gemma_integration_ibm_rom_output.asc").unwrap());
|
||||
}
|
||||
|
||||
@ -35,7 +35,6 @@ fn controls_view(mut system: &mut Chip8Computer, state: &mut EmmaEGuiState, ui:
|
||||
ui.checkbox(&mut state.display_memory, "Display Memory");
|
||||
ui.checkbox(&mut state.display_video, "Display Video");
|
||||
ui.checkbox(&mut state.display_registers, "Display Registers");
|
||||
|
||||
}
|
||||
|
||||
fn registers_view(system: &Chip8Computer, ui:& mut Ui) {
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
******** ********* ***** ***** * *
|
||||
* *
|
||||
******** *********** ****** ****** *
|
||||
|
||||
**** *** *** ***** ***** * *
|
||||
***
|
||||
**** ******* ******* ******* *
|
||||
*
|
||||
**** ******* *** ******* ***
|
||||
*
|
||||
**** *** *** *** ***** ***
|
||||
***
|
||||
******** *********** ***** *** ***** *
|
||||
**
|
||||
******** ********* ***** * ***** ***
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
******** ********* ***** ***** * *
|
||||
* *
|
||||
******** *********** ****** ****** *
|
||||
|
||||
**** *** *** ***** ***** * *
|
||||
***
|
||||
**** ******* ******* ******* *
|
||||
*
|
||||
**** ******* *** ******* ***
|
||||
*
|
||||
**** *** *** *** ***** ***
|
||||
***
|
||||
******** *********** ***** *** ***** *
|
||||
**
|
||||
******** ********* ***** * ***** ***
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user