more dump of "Emma" for Gemma
Video reset now tests ok gemma egui interface now implements stupid workaround for video reset
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use gemma::chip8::computer::Chip8Computer;
|
||||
use gemma::constants::CHIP8_VIDEO_MEMORY;
|
||||
|
||||
#[test]
|
||||
fn smoke() { assert!(true) }
|
||||
@@ -10,7 +11,7 @@ fn test_rom_1_works() {
|
||||
// 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());
|
||||
x.load_bytes_to_memory(0x200, (&test_rom_to_run).into());
|
||||
|
||||
for i in 0..40 {
|
||||
x.step_system();
|
||||
@@ -20,3 +21,21 @@ fn test_rom_1_works() {
|
||||
|
||||
assert_eq!(x.dump_video_to_string(), std::fs::read_to_string("../resources/test/gemma_integration_ibm_rom_output.asc").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reset_clears_video() {
|
||||
let mut x = Chip8Computer::new();
|
||||
|
||||
for i in 0..CHIP8_VIDEO_MEMORY {
|
||||
x.video_memory.poke(i as u16, i % 2 == 0);
|
||||
}
|
||||
|
||||
x.reset();
|
||||
x.video_memory = x.video_memory.reset();
|
||||
|
||||
assert_eq!(x.dump_video_to_string(), x.video_memory.format_as_string());
|
||||
|
||||
for i in 0..CHIP8_VIDEO_MEMORY {
|
||||
assert!(!x.video_memory.peek(i as u16));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user