- Site Admin
- Joined: 19 Oct 1999
- Posts: 14745
- Location: London
|
Delayed interrupts and acknowledgement
Posted: Tue Sep 07, 2021 7:39 am
|
Following some discussion on Discord, I wonder if anyone has experimented or measured the way interrupts are triggered?
Specifically, if I otherwise have frame interrupts working and triggering as normal, if I disable interrupts on the Z80 with di, then some time later a frame interrupt appears, then I re-enable interrupts with ei at some time during the active display; does the frame interrupt happen right then?
I would have thought that this could happen a lot as games often disable interrupts while loading compressed art, then reenable with no consideration of the current screen timing; and interrupt routines often contain code that requires inactive display for accessing VRAM.
Furthermore, if I don’t acknowledge the interrupt with a read from port $BF, does it trigger immediately after the ei/reti?
One way I think this could work is that the VDP has a stateful interrupt signal (low all the time until acknowledged) but the I/O chip might convert it into a ~28 cycle pulse. Or does it just act statefully?
|
- Joined: 05 Sep 2013
- Posts: 3828
- Location: Stockholm, Sweden
|
Posted: Tue Sep 07, 2021 11:36 am
|
from personal experience, if you EI and there's a pending interrupt (an interrupt that got raised while in DI) you get the call almost immediately after that (you know, the one instruction skip)
also, if you don't acknowledge the interrupt (which means: if you don't read VDP port) you won't get more interrupts call
Quote if I disable interrupts on the Z80 with di, then some time later a frame interrupt appears, then I re-enable interrupts with ei at some time during the active display; does the frame interrupt happen right then?
yes, your ISR gets called immediately
|