Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Delayed interrupts and acknowledgement

Reply to topic
Author Message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
Delayed interrupts and acknowledgement
Post 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?
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3761
  • Location: Stockholm, Sweden
Reply with quote
Post 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
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!