Using Wasted Cycles

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
User avatar
Jubatian
Posts: 1564
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Using Wasted Cycles

Post by Jubatian »

CunningFellow wrote:This is savings off entering HSync on no active video lines (where user code gets run) ?
Yes, it is, since the video mode codes never leave the interrupt until they are done with the last line. These 57 cycles are present whenever a HSync interrupt entry happens (which consistently does within VBlank, for most part 1820 cycles apart from each other).
CunningFellow wrote:Would it be trivial to add a 57 cycle -ve offest at the start of active and then a 57 cycle +ve at the end?
You can't do this since that would kill the inline mixer which toggles sync. If you align the video frame to match the original kernel without doing anything with its code, the inline mixer would work there according to the original kernel. Out of the video frame, it would do its stuff 57 cycles too soon, thus destroying the Hsync signal.

The only reasonable way to exploit this boost hack if you have a mode which depends on certain values of the timer (that is, it reads the timer count register and does something with it) is to adjust the values there (subtracting 57 from those should make the code of those modes working proper with the boost).
D3thAdd3r wrote:2000 might be more than 5% that your game actually gains per frame cycles.
Yes, I considered the raw gain there, assuming only an inline mixer was there to steal cycles from your code. With that you have some 55000 - 60000 cycles available in the VBlank of a 224 lines tall mode, so 2000 is even less than 5 percent. If however the kernel takes away a lot there (which can happen for the VSync handler which is started from within the interrupt, so silently "eating away" cycles from "your" VBlank), it may appear much more. So as Alec mentioned (with the music engine), optimizations in stuff happening in the VBlank can also give you a good amount of extra cycles.
Post Reply