Confusion about interrupts

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
HCKTROX
Interested
Posts: 27
Joined: Wed Mar 24, 2010 1:15 am
Location: Chile

Confusion about interrupts

Post by HCKTROX » Fri Aug 07, 2015 3:23 am

I'm very confused about when do H-int and V-int happen. Please take in consideration I put most of VDP writing code on V-int section.

Does the V-int code run before, or after the frame is drawn? If happens after, then does it mean that what we see on screen is 1 frame delayed? :O
And, does the H-int code run before, or after V-int occurs?

Thank you :D
skype: hcktrox

Mask of Destiny
Very interested
Posts: 616
Joined: Thu Nov 30, 2006 6:30 am

Re: Confusion about interrupts

Post by Mask of Destiny » Fri Aug 07, 2015 3:51 am

HCKTROX wrote:Does the V-int code run before, or after the frame is drawn?
In some sense both. It is run after the previous frame is shown and before the next frame is shown. To be more specific, it happens shortly after the last visible line of the image is sent to the TV.
HCKTROX wrote:If happens after, then does it mean that what we see on screen is 1 frame delayed? :O
There's no framebuffer on the Genesis and nothing resembling double buffering. As soon as VBLANK ends, the VDP will start rendering whatever is in its RAM including changes you made in your VINT routine.
HCKTROX wrote:And, does the H-int code run before, or after V-int occurs?
Before. HINT is triggered when the line counter changes and VINT is triggered on line 224 a little after the counter tickets up from 223. That said, VINT has a higher priority than HINT (level 6 vs level 4). This means that it's possible for the VINT routine to get called while your HINT routine is in the middle of running. Not necessarily a big deal, but it can occasionally cause trouble depending on what you do in your HINT and VINT handlers.

Post Reply