Accurate IF clear timing

This commit is contained in:
Lior Halphon 2021-12-05 16:18:54 +02:00
parent 25e3414974
commit 9e57201b08

View File

@ -1639,6 +1639,10 @@ void GB_cpu_run(GB_gameboy_t *gb)
interrupt_queue >>= 1;
interrupt_bit++;
}
assert(gb->pending_cycles > 2);
gb->pending_cycles -= 2;
flush_pending_cycles(gb);
gb->pending_cycles = 2;
gb->io_registers[GB_IO_IF] &= ~(1 << interrupt_bit);
gb->pc = interrupt_bit * 8 + 0x40;
}