Skip to content

Commit

Permalink
Correct the cycle time on interrupt consumption
Browse files Browse the repository at this point in the history
  • Loading branch information
maxfierke committed Jan 24, 2024
1 parent 6e38ef3 commit 78682e4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -1724,8 +1724,9 @@ func (cpu *CPU) PollInterrupts(mmu *mem.MMU, ic *devices.InterruptController) ui
// If we were halted, we're not now!
cpu.halted = false

// Consuming an IRQ is 16 cycles
return 16
// Consuming an IRQ is 20 cycles (Or 5 M-cycles)
// ref: https://gbdev.io/pandocs/Interrupts.html#interrupt-handling
return 20
} else if cpu.halted {
if interrupt := ic.NextRequest(); interrupt != 0 {
// Wakey-wakey
Expand Down

0 comments on commit 78682e4

Please sign in to comment.