WIP
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -26,7 +26,7 @@ impl Keypad {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println!("PREPARE TO RETURN {}", return_value);
|
||||
return_value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,3 +119,4 @@ impl InstructionUtil {
|
||||
working & working_mask as u16
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user