fix clear display instruction

This commit is contained in:
Denis-Cosmin Nutiu 2024-12-10 18:50:24 +02:00
parent 680ee8adeb
commit aa27658864
2 changed files with 6 additions and 3 deletions

View file

@ -201,9 +201,10 @@ where
match instruction.processor_instruction() {
ProcessorInstruction::ClearScreen => {
trace!("Clear display");
self.display_data = [false; DISPLAY_WIDTH * DISPLAY_HEIGHT];
self.display.clear()
}
ProcessorInstruction::Jump(address) => {
ProcessorInstruction::Jump {address} => {
trace!("Jump to address {:04x}", address);
self.program_counter = address
}

View file

@ -17,7 +17,7 @@ pub enum ProcessorInstruction {
/// Clears the screen
ClearScreen,
/// Jumps to a given address
Jump(u16),
Jump {address: u16},
/// Sets the register in the first argument to the given value
SetRegister(u8, u8),
/// Adds the value to the register
@ -125,7 +125,9 @@ impl Instruction {
// Jump
(0x1, _, _, _) => {
// 1NNN
ProcessorInstruction::Jump(Self::grab_inner_data(data))
ProcessorInstruction::Jump {
address: Self::grab_inner_data(data)
}
}
// Set Register
(0x6, _, _, _) => {