TGB1718 Posted December 17, 2022 Share Posted December 17, 2022 I am writing a little demo and was using the VCOUNT register to determine when the screen draw has started and ended, however things didn't work as expected. I am not using VCOUNT in a DLI, so I thought if I put a routine in the Vertical Blank routine I could see the value of the VCOUNT register, I thought it would not be counting at this point, however my results show the VCOUNT register keeps counting even when the screen is not being drawn. I can only assume that the counter is reset to zero at the start of a screen draw, otherwise it's free running after the end of a screen draw, can anyone confirm this. Quote Link to comment Share on other sites More sharing options...
Rybags Posted December 17, 2022 Share Posted December 17, 2022 (edited) VCount is always updated regardless of screen position and whether an active display is occurring or not. VBlank NMI actually occurs some time before VSync - just after the normal 240 scanline display. VSync occurs before VCount rolls back to 0. Visible display values will be same for PAL and NTSC but offscreen can differ since PAL has the extra 50 scanlines. Good practice is to not rely on exact value comparisons outside the visible display since VBlank NMI can potentially take control and skip a bunch of lines. There's also the single cycle occurrence where VCount will hit an overflow value then be adjusted back (refer Altirra Atari HW manual for description) Edited December 17, 2022 by Rybags Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 17, 2022 Author Share Posted December 17, 2022 @Rybags many thanks for your help, I'll have a look at the manual Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.