more sample roms.

more coverage.
This commit is contained in:
Trevor Merritt 2024-11-01 09:41:20 -04:00
parent 13ceb61c97
commit 00c75a82e5
12 changed files with 232 additions and 318 deletions

3
.idea/workspace.xml generated
View File

@ -9,7 +9,8 @@
<component name="ChangeListManager">
<<<<<<< Updated upstream
<list default="true" id="9bcba7c5-ac1d-4216-959a-63faee7047bc" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gemma/src/chip8/video.rs" beforeDir="false" afterPath="$PROJECT_DIR$/gemma/src/chip8/video.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gemmaimgui/src/bin/support/emmagui_support.rs" beforeDir="false" afterPath="$PROJECT_DIR$/gemmaimgui/src/bin/support/emmagui_support.rs" afterDir="false" />
</list>
=======
<list default="true" id="9bcba7c5-ac1d-4216-959a-63faee7047bc" name="Changes" comment="" />

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,42 @@
use std::fs::File;
use std::io::Read;
use std::ops::Add;
use std::path::Path;
use std::time::{Duration, Instant};
use gemma::chip8::computer::Chip8Computer;
use gemma::chip8::computer_manager::Chip8ComputerManager;
const ROM_ROOT: &str = "resources/roms";
fn main() {
let mut x = Chip8ComputerManager::new();
let mut buffer = Vec::new();
let mut input_file = File::open(Path::new(&(ROM_ROOT.to_string() + "/mandelbrot_bench.ch8"))).expect("derp");
input_file.read_to_end(&mut buffer).expect("unable to read file");
x.load_new_program_to_system_memory((&*buffer).into());
for _ in 0..10 {
let start_time = Instant::now();
let mut num_cycles = 0;
// how many instructions in 10s.
let end_time = start_time.add(Duration::from_secs(10));
while (Instant::now().le(&end_time)) {
num_cycles += 1;
x.step();
}
let num = num_cycles.to_string()
.as_bytes()
.rchunks(3)
.rev()
.map(std::str::from_utf8)
.collect::<Result<Vec<&str>, _>>()
.unwrap()
.join(","); // separator
let num_ips = num_cycles / 1000000;
println!("Completed at {num_ips} Mips.");
}
}

View File

@ -35,7 +35,8 @@ impl Chip8SystemMemory {
pub fn peek(&self, address: u16) -> u8 {
trace!("PEEK: {} / {}", address, self.memory[address as usize].clone());
self.memory[address as usize]
let effective = address as i32 % CHIP8_MEMORY_SIZE;
self.memory[effective as usize]
}
pub fn poke(&mut self, address: u16, value: u8) {

View File

@ -3,7 +3,7 @@ use crate::chip8::video::Chip8VideoModes::{HighRes, LowRes};
use crate::constants::{CHIP8_VIDEO_HEIGHT, CHIP8_VIDEO_MEMORY, CHIP8_VIDEO_WIDTH, SCHIP_VIDE_MEMORY, SCHIP_VIDEO_HEIGHT, SCHIP_VIDEO_WIDTH};
#[derive(Clone, Copy)]
enum Chip8VideoModes {
pub enum Chip8VideoModes {
LowRes,
HighRes,
}
@ -15,15 +15,10 @@ pub struct Chip8Video {
current_res: Chip8VideoModes,
}
impl Chip8Video {
pub fn scroll_up(&self, how_far: &u8) {
println!("Scrolling up {how_far} rows.");
}
}
impl Chip8Video {
pub fn reset(&mut self) {
self.cls();
self.set_lowres();
self.start_frame();
}
@ -186,6 +181,26 @@ impl Chip8Video {
}
}
pub fn scroll_up(&mut self, how_far: &u8) {
let how_far = *how_far as i32;
let (width, height) = self.get_resolution();
let row_shift = how_far * width;
for current_source_row in how_far..height {
let current_source_offset = current_source_row * width;
for current_source_column in 0..width {
let base_offset: usize = (current_source_offset + current_source_column) as usize;
let shifted_offset: usize = base_offset - row_shift as usize;
self.memory[shifted_offset] = self.memory[base_offset];
}
}
// Clear the new bottom rows after shifting
let clear_start = ((height - how_far) * width) as usize;
self.memory[clear_start..].fill(false);
}
pub fn scroll_down(&mut self, how_far: i32) {
let (width, height) = self.get_resolution();
let row_shift = how_far * width;

View File

@ -3,13 +3,14 @@ use rand::random;
use gemma::chip8::computer::Chip8Computer;
use gemma::chip8::delay_timer::DelayTimer;
use gemma::chip8::instructions::Chip8CpuInstructions;
use gemma::chip8::instructions::Chip8CpuInstructions::JPX;
use gemma::chip8::keypad::Keypad;
use gemma::chip8::quirk_modes::QuirkMode::{Chip8, SChipModern, XOChip};
use gemma::chip8::registers::Chip8Registers;
use gemma::chip8::sound_timer::SoundTimer;
use gemma::chip8::stack::Chip8Stack;
use gemma::chip8::util::InstructionUtil;
use gemma::chip8::video::Chip8Video;
use gemma::chip8::video::{Chip8Video, Chip8VideoModes};
use gemma::constants::*;
const TEST_OUTPUT_SAMPLE_DIR: &str = "../resources/test/";
@ -24,103 +25,6 @@ fn smoke() {
assert!(true)
}
#[test]
fn encode_decode_test() {
assert_eq!(Chip8CpuInstructions::CLS.encode(), 0x00E0);
assert_eq!(Chip8CpuInstructions::RET.encode(), 0x00EE);
assert_eq!(Chip8CpuInstructions::SYS(0x123).encode(), 0x0123);
assert_eq!(Chip8CpuInstructions::JPA(0x234).encode(), 0x1234);
assert_eq!(Chip8CpuInstructions::CALL(0x345).encode(), 0x2345);
assert_eq!(Chip8CpuInstructions::SEX(0x4, 0x56).encode(), 0x3456);
assert_eq!(Chip8CpuInstructions::SNEB(0xa, 0xbc).encode(), 0x4abc);
assert_eq!(Chip8CpuInstructions::SEY(0xa, 0xb).encode(), 0x5ab0);
assert_eq!(Chip8CpuInstructions::LDR(0xa, 0xff).encode(), 0x6aff);
assert_eq!(Chip8CpuInstructions::ADD(0xa, 0xbc).encode(), 0x7abc);
assert_eq!(Chip8CpuInstructions::LDR_Y(0xa, 0xb).encode(), 0x8ab0);
assert_eq!(Chip8CpuInstructions::OR(0xb, 0xa).encode(), 0x8ba1);
assert_eq!(Chip8CpuInstructions::AND(0xc, 0xd).encode(), 0x8cd2);
assert_eq!(Chip8CpuInstructions::ORY(0xd, 0xe).encode(), 0x8de3);
assert_eq!(Chip8CpuInstructions::ADDR(0xe, 0xf).encode(), 0x8ef4);
assert_eq!(Chip8CpuInstructions::SUB(0xf, 0x0).encode(), 0x8f05);
assert_eq!(Chip8CpuInstructions::SHR(0x0, 0x1).encode(), 0x8016);
assert_eq!(Chip8CpuInstructions::SUBC(0x1, 0x2).encode(), 0x8127);
assert_eq!(Chip8CpuInstructions::SHL(0x3, 0x4).encode(), 0x834e);
assert_eq!(Chip8CpuInstructions::SNEY(0xa, 0xb).encode(), 0x9ab0);
assert_eq!(Chip8CpuInstructions::LDIA(0x123).encode(), 0xa123);
assert_eq!(Chip8CpuInstructions::JPI(0x234).encode(), 0xb234);
assert_eq!(Chip8CpuInstructions::RND(0xa, 0xca).encode(), 0xcaca);
assert_eq!(Chip8CpuInstructions::DRW(0xa, 0xb, 0x4).encode(), 0xdab4);
assert_eq!(Chip8CpuInstructions::SKP(0x1).encode(), 0xe19e);
assert_eq!(Chip8CpuInstructions::SKNP(0x2).encode(), 0xe2a1);
assert_eq!(Chip8CpuInstructions::LDRD(0x1).encode(), 0xf107);
assert_eq!(Chip8CpuInstructions::LDRK(0x4).encode(), 0xf40a);
assert_eq!(Chip8CpuInstructions::LDD(0x6).encode(), 0xf615);
assert_eq!(Chip8CpuInstructions::LDIS(0xb).encode(), 0xfb18);
assert_eq!(Chip8CpuInstructions::ADDI(0xd).encode(), 0xfd1e);
assert_eq!(Chip8CpuInstructions::LDFX(0xc).encode(), 0xfc29);
assert_eq!(Chip8CpuInstructions::BCD(0xd).encode(), 0xfd33);
assert_eq!(Chip8CpuInstructions::LDIX(0xe).encode(), 0xfe55);
assert_eq!(Chip8CpuInstructions::LDRI(0x3).encode(), 0xf365);
assert_eq!(Chip8CpuInstructions::SCD(0x1).encode(), 0x00C1);
assert_eq!(Chip8CpuInstructions::SCL.encode(), 0x00FC);
assert_eq!(Chip8CpuInstructions::SCR.encode(), 0x00FB);
assert_eq!(Chip8CpuInstructions::EXIT.encode(), 0x00FD);
assert_eq!(Chip8CpuInstructions::HIGH.encode(), 0x00FF);
assert_eq!(Chip8CpuInstructions::LOW.encode(), 0x00FE);
assert_eq!(Chip8CpuInstructions::LDF2(0).encode(), 0xF030);
assert_eq!(Chip8CpuInstructions::STR(1).encode(), 0xF175);
assert_eq!(Chip8CpuInstructions::LIDR(1).encode(), 0xF185);
/*
assert!(matches!(Chip8CpuInstructions::decode(0xF175), Chip8CpuInstructions::STR(1)));
assert!(matches!(Chip8CpuInstructions::decode(0xF185), Chip8CpuInstructions::LIDR(1)));
assert!(matches!(Chip8CpuInstructions::decode(0x00C1u16), Chip8CpuInstructions::SDN(0x01)));
assert!(matches!(Chip8CpuInstructions::decode(0x00FCu16), Chip8CpuInstructions::SLF));
assert!(matches!(Chip8CpuInstructions::decode(0x00FBu16), Chip8CpuInstructions::SRT));
assert!(matches!(Chip8CpuInstructions::decode(0x00FDu16), Chip8CpuInstructions::EXIT));
assert!(matches!(Chip8CpuInstructions::decode(0x00FEu16), Chip8CpuInstructions::DIS));
assert!(matches!(Chip8CpuInstructions::decode(0x00FFu16), Chip8CpuInstructions::ENA));
assert!(matches!(Chip8CpuInstructions::decode(0xF030u16), Chip8CpuInstructions::LDF2(0)));
assert!(matches!(Chip8CpuInstructions::decode(0x00E0u16), Chip8CpuInstructions::CLS));
assert!(matches!(Chip8CpuInstructions::decode(0x00EEu16), Chip8CpuInstructions::RET));
assert!(matches!(Chip8CpuInstructions::decode(0x0123), Chip8CpuInstructions::SYS(0x123)));
assert!(matches!(Chip8CpuInstructions::decode(0x0FFF), Chip8CpuInstructions::SYS(0xfff)));
assert!(matches!(Chip8CpuInstructions::decode(0x1002), Chip8CpuInstructions::JPA(0x2)));
assert!(matches!(Chip8CpuInstructions::decode(0x1FF0), Chip8CpuInstructions::JPA(0xFF0)));
assert!(matches!(Chip8CpuInstructions::decode(0x2002), Chip8CpuInstructions::CALL(0x2)));
assert!(matches!(Chip8CpuInstructions::decode(0x3123), Chip8CpuInstructions::SEX(0x1, 0x23)));
assert!(matches!(Chip8CpuInstructions::decode(0x4abc), Chip8CpuInstructions::SNEB(0xa, 0xbc)));
assert!(matches!(Chip8CpuInstructions::decode(0x5ab0), Chip8CpuInstructions::SEY(0xa, 0xb)));
assert!(matches!(Chip8CpuInstructions::decode(0x6aff), Chip8CpuInstructions::LDR(0xa, 0xff)));
assert!(matches!(Chip8CpuInstructions::decode(0x7abc), Chip8CpuInstructions::ADD(0xa, 0xbc)));
assert!(matches!(Chip8CpuInstructions::decode(0x8ab0), Chip8CpuInstructions::LDR_Y(0xa, 0xb)));
assert!(matches!(Chip8CpuInstructions::decode(0x8ba1), Chip8CpuInstructions::OR(0xb, 0xa)));
assert!(matches!(Chip8CpuInstructions::decode(0x8cd2), Chip8CpuInstructions::AND(0xc, 0xd)));
assert!(matches!(Chip8CpuInstructions::decode(0x8de3), Chip8CpuInstructions::ORY(0xd, 0xe)));
assert!(matches!(Chip8CpuInstructions::decode(0x8ef4), Chip8CpuInstructions::ADDR(0xe, 0xf)));
assert!(matches!(Chip8CpuInstructions::decode(0x8f05), Chip8CpuInstructions::SUB(0xf, 0x0)));
assert!(matches!(Chip8CpuInstructions::decode(0x8016), Chip8CpuInstructions::SHR(0x0, 0x1)));
assert!(matches!(Chip8CpuInstructions::decode(0x8127), Chip8CpuInstructions::SUBC(0x1, 0x2)));
assert!(matches!(Chip8CpuInstructions::decode(0x834e), Chip8CpuInstructions::SHL(0x3, 0x4)));
assert!(matches!(Chip8CpuInstructions::decode(0x9ab0), Chip8CpuInstructions::SNEY(0xa, 0xb)));
assert!(matches!(Chip8CpuInstructions::decode(0xa123), Chip8CpuInstructions::LDIA(0x123)));
assert!(matches!(Chip8CpuInstructions::decode(0xb234), Chip8CpuInstructions::JPI(0x234)));
assert!(matches!(Chip8CpuInstructions::decode(0xcaca), Chip8CpuInstructions::RND(0xa, 0xca)));
assert!(matches!(Chip8CpuInstructions::decode(0xdab4), Chip8CpuInstructions::DRW(0xa, 0xb, 0x4)));
assert!(matches!(Chip8CpuInstructions::decode(0xe19e), Chip8CpuInstructions::SKP(0x1)));
assert!(matches!(Chip8CpuInstructions::decode(0xe2a1), Chip8CpuInstructions::SKNP(0x2)));
assert!(matches!(Chip8CpuInstructions::decode(0xf107), Chip8CpuInstructions::LDRD(0x1)));
assert!(matches!(Chip8CpuInstructions::decode(0xf40a), Chip8CpuInstructions::LDRK(0x4)));
assert!(matches!(Chip8CpuInstructions::decode(0xf615), Chip8CpuInstructions::LDD(0x6)));
assert!(matches!(Chip8CpuInstructions::decode(0xfb18), Chip8CpuInstructions::LDIS(0xb)));
assert!(matches!(Chip8CpuInstructions::decode(0xfd1e), Chip8CpuInstructions::ADDI(0xd)));
assert!(matches!(Chip8CpuInstructions::decode(0xfc29), Chip8CpuInstructions::LDFX(0xc)));
assert!(matches!(Chip8CpuInstructions::decode(0xfd33), Chip8CpuInstructions::BCD(0xd)));
assert!(matches!(Chip8CpuInstructions::decode(0xfe55), Chip8CpuInstructions::LDIX(0xe)));
assert!(matches!(Chip8CpuInstructions::decode(0xf365), Chip8CpuInstructions::LDRI(0x3)));
*/
}
#[test]
fn decoder_test_invalid_instructions() {
@ -1410,3 +1314,51 @@ fn computer_dump_registers_to_string() {
// now verify.
assert_eq!(expected_value, x.dump_registers_to_string());
}
#[test]
fn video_scroll_up_tests_sd() {
let mut x = build_checkerboard();
let distance = 1u8;
x.scroll_up(&distance);
assert_eq!(read_test_result("test_video_scroll_up_test_sd.asc"), x.format_as_string());
}
#[test]
fn video_scroll_up_tests_hd() {
let mut x = build_checkboard_hd();
let distance = 1u8;
x.scroll_up(&distance);
assert_eq!(read_test_result("test_video_scroll_up_test_hd.asc"), x.format_as_string());
}
#[test]
fn video_resolution_changing() {
let mut x = Chip8Video::default();
x.set_highres();
assert_eq!(x.get_resolution(), (SCHIP_VIDEO_WIDTH, SCHIP_VIDEO_HEIGHT));
assert!(matches!(x.get_screen_resolution(), Chip8VideoModes::HighRes));
x.set_lowres();
assert_eq!(x.get_resolution(), (CHIP8_VIDEO_WIDTH, CHIP8_VIDEO_HEIGHT));
assert!(matches!(x.get_screen_resolution(), Chip8VideoModes::LowRes));
}
#[test]
fn delay_timer_default() {
let t = DelayTimer::default();
assert_eq!(t.current(), 0xff);
}
#[test]
fn instruction_jpx() {
// JPX -> 0xBXnn
// Jump to Xnn+Vx
let mut x = Chip8Computer::new();
// set X1 to 4...
x.registers.poke(0x01, 0x04);
// ...use (x1)+0x134
let to_execute = JPX(0x01, 0x34);
// expect to set PC to 0x524
to_execute.execute(&mut x);
assert_eq!(x.registers.peek_pc(), 0x524);
}

View File

@ -563,20 +563,30 @@ fn instructions_encode_decode_tests_with_quirks() {
xochip: SKP(0x01),
}
},
InstructionTest {
name: INST_SNEY.to_string(),
instruction: SNEY(0x01, 0x1),
operands: "0x01, 0x01".to_string(),
asm: "SNEY 0x01, 0x01".to_string(),
encoded: 0x0000,
operands: "0x1, 0x1".to_string(),
asm: "SNEY 0x1, 0x1".to_string(),
encoded: 0x9110,
quirks: InstructionTestQuirks {
chip8: SNEY(0x01, 0x1),
schip: SNEY(0x01, 0x1),
xochip: SNEY(0x01, 0x1),
}
},
InstructionTest {
name: INST_SKNP.to_string(),
instruction: SKNP(0x01),
operands: "0x01".to_string(),
asm: "SKNP 0x01".to_string(),
encoded: 0xe1a1,
quirks: InstructionTestQuirks {
chip8: SKNP(0x01),
schip: SKNP(0x01),
xochip: SKNP(0x01),
}
},
];
for current in it {
@ -607,206 +617,3 @@ fn instructions_encode_decode_tests_with_quirks() {
assert!(matches!(as_xochip, quirks_xochip));
}
}
/*
InstructionTest {
name: INST_LDRY.to_string(),
instruction: Chip8CpuInstructions::LDR_Y(0x1, 0x2),
operands: "0x1, 0x2".to_string(),
asm: "LDRY 0x1, 0x2".to_string(),
encoded: 0x8120,
},
InstructionTest {
name: INST_OR.to_string(),
instruction: Chip8CpuInstructions::OR(0x1, 0x2),
operands: "0x1, 0x2".to_string(),
asm: "OR 0x1, 0x2".to_string(),
encoded: 0x8121
},
InstructionTest {
name: INST_AND.to_string(),
instruction: Chip8CpuInstructions::AND(0xb, 0xc),
operands: "0xb, 0xc".to_string(),
asm: "AND 0xb, 0xc".to_string(),
encoded: 0x8bc2,
},
InstructionTest {
name: INST_ORY.to_string(),
instruction: Chip8CpuInstructions::ORY(0xa, 0x3),
operands: "0xa, 0x3".to_string(),
asm: "ORY 0xa, 0x3".to_string(),
encoded: 0x8a33
},
InstructionTest {
name: INST_ADDR.to_string(),
instruction: Chip8CpuInstructions::ADDR(0x1, 0x2),
operands: "0x1, 0x2".to_string(),
asm: "ADDR 0x1, 0x2".to_string(),
encoded: 0x8124
},
InstructionTest {
name: INST_SUB.to_string(),
instruction: Chip8CpuInstructions::SUB(0x4, 0x5),
operands: "0x4, 0x5".to_string(),
asm: "SUB 0x4, 0x5".to_string(),
encoded: 0x8455
},
InstructionTest {
name: INST_SHR.to_string(),
instruction: Chip8CpuInstructions::SHR(0x01, 0x1),
operands: "0x1, 0x1".to_string(),
asm: "SHR 0x1, 0x1".to_string(),
encoded: 0x8116,
},
InstructionTest {
name: INST_SUBC.to_string(),
instruction: Chip8CpuInstructions::SUBC(0xf, 0xa),
operands: "0xf, 0xa".to_string(),
asm: "SUBC 0xf, 0xa".to_string(),
encoded: 0x8fa7,
},
InstructionTest {
name: INST_SHL.to_string(),
instruction: Chip8CpuInstructions::SHL(0x1, 0x4),
operands: "0x1, 0x4".to_string(),
asm: "SHL 0x1, 0x4".to_string(),
encoded: 0x814e,
},
InstructionTest {
name: INST_SNEY.to_string(),
instruction: Chip8CpuInstructions::SNEY(0x4, 0x5),
operands: "0x4, 0x5".to_string(),
asm: "SNEY 0x4, 0x5".to_string(),
encoded: 0x9450,
},
InstructionTest {
name: INST_LDIA.to_string(),
instruction: Chip8CpuInstructions::LDIA(0xbee),
operands: "0x0bee".to_string(),
asm: "LDIA 0x0bee".to_string(),
encoded: 0x9bee
},
InstructionTest {
name: INST_JPI.to_string(),
instruction: Chip8CpuInstructions::JPI(0xfee),
operands: "0x0fee".to_string(),
asm: "JPI 0x0fee".to_string(),
encoded: 0xbfee
},
InstructionTest {
name: INST_RND.to_string(),
instruction: Chip8CpuInstructions::RND(0x1, 0xae),
operands: "0x01, 0xae".to_string(),
asm: "RND 0x01, 0xae".to_string(),
encoded: 0xc1ae,
},
InstructionTest {
name: INST_DRW.to_string(),
instruction: Chip8CpuInstructions::DRW(0x1, 0x2, 0xf),
operands: "0x01, 0x02, 0x0f".to_string(),
asm: "DRW 0x01, 0x02, 0x0f".to_string(),
encoded: 0xd12f
},
InstructionTest {
name: INST_SKP.to_string(),
instruction: Chip8CpuInstructions::SKP(0x4),
operands: "0x04".to_string(),
asm: "SKP 0x04".to_string(),
encoded: 0xe49e,
},
InstructionTest {
name: INST_SKNP.to_string(),
instruction: Chip8CpuInstructions::SKNP(0x3),
operands: "0x03".to_string(),
asm: "SKNP 0x03".to_string(),
encoded: 0x83a1
},
InstructionTest {
name: INST_LDRD.to_string(),
instruction: Chip8CpuInstructions::LDRD(0x4),
operands: "0x04".to_string(),
asm: "LDRD 0x04".to_string(),
encoded: 0xF407
}
InstructionTest {
name: INST_LDD.to_string(),
instruction: Chip8CpuInstructions::LDD(0x02),
operands: "0x02".to_string(),
asm: "LDD 0x02".to_string(),
encoded: 0xF215,
},
InstructionTest {
name: INST_LDRI.to_string(),
instruction: Chip8CpuInstructions::LDRI(0x01),
operands: "0x01".to_string(),
asm: "LDRI 0x01".to_string(),
encoded: 0xF118,
},
InstructionTest {
name: INST_BCD.to_string(),
instruction: Chip8CpuInstructions::BCD(0x4),
operands: "0x04".to_string(),
asm: "BCD 0x04".to_string(),
encoded: 0xF433,
},
InstructionTest {
name: INST_LDF.to_string(),
instruction: Chip8CpuInstructions::LDFX(0x5),
operands: "0x05".to_string(),
asm: "LDF 0x05".to_string(),
encoded: 0xF529
},
InstructionTest {
name: INST_LDF2.to_string(),
instruction: Chip8CpuInstructions::LDF2(0x6),
operands: "0x06".to_string(),
asm: "LDF2 0x06".to_string(),
encoded: 0xF630
},
InstructionTest {
name: INST_LDIX.to_string(),
instruction: Chip8CpuInstructions::LDIX(0x5),
operands: "0x05".to_string(),
asm: "LDIX 0x05".to_string(),
encoded: 0xF555
},
InstructionTest {
name: INST_LDIS.to_string(),
instruction: Chip8CpuInstructions::LDIS(0xf),
operands: "0x0f".to_string(),
asm: "LDIS 0x0f".to_string(),
encoded: 0xFF18
},
InstructionTest {
name: INST_LIDR.to_string(),
instruction: Chip8CpuInstructions::LIDR(0x4),
operands: "0x04".to_string(),
asm: "LIDR 0x04".to_string(),
encoded: 0xF485,
},
InstructionTest {
name: INST_STR.to_string(),
instruction: Chip8CpuInstructions::STR(0xa),
operands: "0x0a".to_string(),
asm: "STR 0x0a".to_string(),
encoded: 0xF000
}
InstructionTest {
name: INST_JPA.to_string(),
instruction: JPA(0x234),
asm: "JPA 0x0234".to_string(),
encoded: 0xb234,
operands: "0x0234".to_string(),
quirks: InstructionTestQuirks {
chip8: JPA(0x0234),
schip: JPA(0x0234),
xochip: JPA(0x0234)
}
},
*/

View File

@ -46,7 +46,7 @@ impl Default for ImGuiUiState {
is_running: false,
frame_time: 16,
last_frame_instant: Instant::now(),
target_ips: 20
target_ips: 200000
}
}
}

Binary file not shown.

BIN
resources/roms/golf.ch8 Normal file

Binary file not shown.

View File

@ -0,0 +1,64 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

View File

@ -0,0 +1,32 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *