[cpu] Add decode for procedures and conditional jumps

This commit is contained in:
2024-03-04 18:03:56 +05:30
parent 1690c52bac
commit c83b90aead
2 changed files with 99 additions and 14 deletions

View File

@@ -102,6 +102,9 @@ impl Device {
let y = self.registers.v[regy] as usize;
let toggle_state = self.draw_sprite_at_location(x, y, n);
self.set_flag_register(toggle_state);
},
remaining=>{
log::error!("Unimplemented instruction {:?}",remaining);
}
};
}
@@ -124,7 +127,7 @@ impl Device {
let bit_is_true = (slice_from_memory & (1 << bit_index)) == (1<<bit_index) ;
// if the pixel is going to be toggled false, set this flag bit to true
if(frame_buffer[index + (7 - bit_index)] && (bit_is_true)) { is_pixel_toggled_off = true;}
if frame_buffer[index + (7 - bit_index)] && (bit_is_true) { is_pixel_toggled_off = true;}
frame_buffer[index + (7 - bit_index)] = frame_buffer[index + (7 - bit_index)] ^ (bit_is_true);
}
}