Skip to content

Commit 533e530

Browse files
committed
fix: minor bug fix
1 parent 40d93ae commit 533e530

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: src/chip8.rs

+4
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ impl Chip8 {
447447
}
448448

449449
pub(crate) fn cycle(&mut self) -> Chip8Result<()> {
450+
if self.pc >= 0xFFF {
451+
self.pc = 0x200;
452+
}
453+
450454
let hi_byte = self.memory[self.pc as usize] as u16;
451455
let lo_byte = self.memory[(self.pc + 1) as usize] as u16;
452456
self.opcode = (hi_byte << 8) | lo_byte;

0 commit comments

Comments
 (0)