move ime_scheduled logic from opcode handler
This commit is contained in:
parent
8fc35fa1e1
commit
d73fbc827c
|
@ -30,6 +30,14 @@ impl CPU {
|
||||||
self.last_instruction_addr = self.reg.pc;
|
self.last_instruction_addr = self.reg.pc;
|
||||||
let opcode = self.next_opcode();
|
let opcode = self.next_opcode();
|
||||||
self.last_instruction = opcode;
|
self.last_instruction = opcode;
|
||||||
|
|
||||||
|
if self.memory.ime_scheduled > 0 {
|
||||||
|
self.memory.ime_scheduled = self.memory.ime_scheduled.saturating_sub(1);
|
||||||
|
if self.memory.ime_scheduled == 0 {
|
||||||
|
self.memory.ime = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
verbose_println!(
|
verbose_println!(
|
||||||
"exec {:#4X} from pc: {:#X}",
|
"exec {:#4X} from pc: {:#X}",
|
||||||
opcode,
|
opcode,
|
||||||
|
|
Loading…
Reference in a new issue