prevent panic on overflow when incrementing program counter
This commit is contained in:
parent
ac023fdc31
commit
7510ad13cd
1 changed files with 1 additions and 1 deletions
|
@ -1213,7 +1213,7 @@ impl CPU {
|
||||||
fn next_opcode(&mut self) -> u8 {
|
fn next_opcode(&mut self) -> u8 {
|
||||||
unsafe {
|
unsafe {
|
||||||
let opcode = self.memory.get(self.state.pc.as_u16);
|
let opcode = self.memory.get(self.state.pc.as_u16);
|
||||||
self.state.pc.as_u16 += 0x1;
|
self.state.pc.as_u16 = self.state.pc.as_u16.wrapping_add(0x1);
|
||||||
return opcode;
|
return opcode;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue