This commit is contained in:
2025-05-31 22:56:05 -04:00
parent ef3d605528
commit 21f6e492f6
30 changed files with 1145 additions and 1286 deletions
+4
View File
@@ -75,6 +75,10 @@ impl Chip8Computer {
self.clone().video_memory.format_as_string()
}
pub fn dump_state_to_json(&self) -> String {
serde_json::to_string(self).unwrap()
}
pub fn new() -> Self {
Chip8Computer::default()
}
+4 -1
View File
@@ -410,8 +410,10 @@ impl Display for Chip8CpuInstructions {
impl Chip8CpuInstructions {
pub fn from_str(input: &str) -> Chip8CpuInstructions {
// split the instruction into its parts...
let mut parts = input.split(" ");
// print!("THERE ARE {} PARTS", parts.clone().count());
let first_part = parts.next().unwrap_or("").to_ascii_uppercase();
// take the next value...
// ...strip off the extra...
@@ -450,6 +452,7 @@ impl Chip8CpuInstructions {
"\tFirst part is {:?} / {:?} / {:?} / {:?}",
first_part, param1, param2, param3
);
println!("MATCHING [[{}]]", first_part);
match first_part.as_str() {
INST_ADDI => ADDI(param1 as u8),
INST_ADD => ADD(param1 as u8, param2 as u8),
+1 -1
View File
@@ -26,7 +26,7 @@ impl Keypad {
}
}
}
println!("PREPARE TO RETURN {}", return_value);
return_value
}
}
+1
View File
@@ -119,3 +119,4 @@ impl InstructionUtil {
working & working_mask as u16
}
}