Removing test programs, finished all chip8 related quirks

This commit is contained in:
2026-01-31 01:24:39 -06:00
parent 3693caa458
commit daf87fa5d2
19 changed files with 13 additions and 1 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -18,6 +18,7 @@ static CYCLES_PER_FRAME: u32 = 10;
struct Chip8State {
// Flags
eti_600_flag: bool,
vblank_waiting: bool,
// Memory
mem: [u8; MEMORY_LIMIT as usize],
@@ -50,6 +51,7 @@ pub struct Chip8Quirks {
pub fn run<S: AsRef<str>>(chip8_executable_filepath: S, quirks: &Chip8Quirks, debug_mode: bool) {
let mut state = Chip8State {
eti_600_flag: false,
vblank_waiting: false,
mem: [0; 4096],
stack: [0; 16],
r_v: [0; 16],
@@ -122,6 +124,7 @@ fn start(state: &mut Chip8State, quirks: &Chip8Quirks, debug_mode: bool) {
input::handle_input(state, &mut rl);
state.vblank_waiting = false;
for _ in 0..CYCLES_PER_FRAME {
let instruction_bytes =
memory::read_n_bytes(&state.mem, state.mem.len(), state.r_pc as usize, 2);
@@ -134,6 +137,10 @@ fn start(state: &mut Chip8State, quirks: &Chip8Quirks, debug_mode: bool) {
}
cpu::execute_instruction(state, instruction, &quirks);
if state.vblank_waiting {
break;
}
}
// move to timers.rs

View File

@@ -128,6 +128,10 @@ pub fn execute_instruction(state: &mut Chip8State, instruction: u16, quirks: &Ch
} else {
gpu::draw(state, x, y, &bytes, n);
}
if quirks.display_wait {
state.vblank_waiting = true;
}
}
(0xE, _, _, 0xE) => {
let key_index = state.r_v[x as usize];

View File

@@ -22,7 +22,8 @@ fn main() {
|| args.quirks.contains(&String::from("chip8")),
memory: args.quirks.contains(&String::from("memory"))
|| args.quirks.contains(&String::from("chip8")),
display_wait: args.quirks.contains(&String::from("displaywait")),
display_wait: args.quirks.contains(&String::from("displaywait"))
|| args.quirks.contains(&String::from("chip8")),
clipping: args.quirks.contains(&String::from("clipping"))
|| args.quirks.contains(&String::from("chip8")),
shifting: args.quirks.contains(&String::from("shifting")),