Random mini-hack: if you want a challenge, here it is: faster S2 special stages
. There is a very minor slowdown when lots of objects are on-screen, which I don't think it is noticeable.
Now, if instead of liking challenges you are downright masochistic, you can try the super fast S2 special stages
; this one has more of a slowdown when lots of objects are on-screen, but it is still very minor.
Background: while figuring out how the S2 special stages do their drawing, I saw that the main drawing function was slower than it could be: it is, in fact, about 20 times slower (!) than it needs to be. It is so slow that it takes more than one frame to draw one fourth of the screen -- the screen is displayed for an additional frame after 8 frames drawing it, so the S2 special stage framerate is a paltry 20/3 frames/second. Most of the time is 'wasted' in decoding the compressed data. Note that a good deal of the second frame was left to objects' code and a few other things.
So I included the pre-decompressed drawing data instead; a total decompression causes the data size to increase by about a factor of 10. It is possible to only unpack the original data (it is in a bitstream format) and only double the data size, but this leads to noticeable slowdowns with lots of objects on-screen. The size increase can probably be reduced by measures such as the S3&K objects and priority manager, by porting S3&K-style KosM decoding with a $700 byte module size for the track drawing, and so on.
Anyway: I rewrote the drawing routine to take advantage of the uncompressed data, making it enormously faster. For almost all of the time, the framerate is now multiplied by 9/5 -- to a final 12 frames/second. The super fast version queues two DMAs at once (drawing half a screen per frame), and does not show for an added frame after; thus, it is 5/2 times as fast as the other version, for a total of 30 frames/second -- with small amounts of lag in some places with lots of objects.
I won't be working on this any further, it is just a proof of concept.
This post has been edited by flamewing: 16 February 2012 - 02:03 PM