taylus/gbdotnet

Make EI enable interrupts next cycle, not this cycle

taylus opened this issue · 0 comments

Per https://github.com/AntonioND/giibiiadvance/blob/master/docs/TCAGBD.pdf,

Note that EI doesn't enable the interrupts the same cycle it is executed, but the next cycle:

di
ld  a, IEF_TIMER
ld  [rIE], a
ld  [rIF], a
ei
inc a ; This is still executed before jumping to the interrupt vector.
inc a ; This is executed after returning.
ld   [hl+],a