#27430 - ScottLininger - Tue Oct 12, 2004 10:05 pm
Can anyone point me at a reference that describes what actually happens when an interrupt fires?
Specifically, I'm trying to understand what happens if an HBLANK or VBLANK interrupt calls a function that takes too long to execute. I mean, if your VBLANK function contains a lot of calculations that go beyond the length of the VBLANK, will the next VBlank INTERRUPT the function? Similarly, will an HBLANK interrupt itself if it goes too many cycles? Might this cause a crash?
I have a bug where I am changing the blending register every HBLANK to create a fog effect, and on hardware it seems to be causing a crash. Here's the code:
FogAmount is a pre-calculated array of valid REG_COLV values that creates a gradient of transparency.
statusWindowTop contains a u16 that changes as a "window" appears on the bottom of the screen, which offsets the fog.
With this code in place, my game will run for anywhere from 1-12 minutes before it totally crashes on hardware. With it commented out, no crash. I'm assuming it has something to do with how my interrupts are playing together. I'm running a VBLANK and a TIMER interrupt besides this one.
Thanks!
-Scott
Specifically, I'm trying to understand what happens if an HBLANK or VBLANK interrupt calls a function that takes too long to execute. I mean, if your VBLANK function contains a lot of calculations that go beyond the length of the VBLANK, will the next VBlank INTERRUPT the function? Similarly, will an HBLANK interrupt itself if it goes too many cycles? Might this cause a crash?
I have a bug where I am changing the blending register every HBLANK to create a fog effect, and on hardware it seems to be causing a crash. Here's the code:
Code: |
void HBLANK(void)
{ // alter the transparency of our "fog" layer REG_COLV = FogAmount[REG_VCOUNT+80-(statusWindowTop>>1)]; REG_IF |= INT_HBLANK; } |
FogAmount is a pre-calculated array of valid REG_COLV values that creates a gradient of transparency.
statusWindowTop contains a u16 that changes as a "window" appears on the bottom of the screen, which offsets the fog.
With this code in place, my game will run for anywhere from 1-12 minutes before it totally crashes on hardware. With it commented out, no crash. I'm assuming it has something to do with how my interrupts are playing together. I'm running a VBLANK and a TIMER interrupt besides this one.
Thanks!
-Scott