02-14-2022, 12:52 PM
(This post was last modified: 02-15-2022, 02:55 AM by winteriscoming.)
(02-14-2022, 05:33 AM)sodthor Wrote: First, do you execute the hblank every line? if yes, maybe try only evry4 lines as 8, 60 and 100 are multiple of 4. You can also adapt your gfx to multiples of 8 (64 & 96 or 104).I very likely am running hblank every line. Which part of the setup controls the line interval?
Then compile with -S flag to check the compiled code of the hblank and change the condition order to see if it's simpler or not.
What is the hb counter used for? if you have ras_y...
Maybe to avoid conditions, you can do a specific hblank for each situation: showHUD, boss room and/or screenSplit...
I'll try on my side tomorrow to see if asm can be useful because as I said, most of the time, the compiler is better than me, and modifying my C code to help the compiler is often the best solution.
I am using myHBCounter as a measure of how many hblanks there have been since the game loop started. I set it to 0 at the beginning of the loop and nop at the end until it reaches something like 20 as a means of running the game loop asynchronous to vblank. I could probably just check against ras_y and eliminate that.
Ah, I see, I don't have to have a one size fits all hblank. I could have the game loop initialize a specific hblank function for each scenario. That will probably help.
Thanks for the pointers!

