Freeplaytech Forum

Full Version: Working with h-blank interrupt?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Yes please if you have some code to check, it will easier.
Even full code, I'll sign a NDA to keep it secret Wink
(06-24-2020, 07:36 PM)sodthor Wrote: [ -> ]Yes please if you have some code to check, it will easier.
Even full code, I'll sign a NDA to keep it secret Wink


Let's start a little smaller.  Tongue 

The attached code draws a gradient, and even with all the other stuff from my game removed, the gradient still misbehaves on real hardware.

Edit:  I attached even simpler code that exemplifies the issue I'm having.  It has scroll plane 2 segmented into 3 sections.  Some text is printed in the top, middle and bottom.  The middle section moves SCR2_X by 1, and the bottom section moves SCR2_X by 2, so the bottom section scrolls faster than the middle.  The top section stays still.

When the scrolling code is introduced into the hblank in addition to gradient, that's when things misbehave on real hardware.  I can get the gradient working with no issues, if I do only the gradient and forego split scrolling.
Ok works fine on emu, I'll test it asap on HW (I need to reinstall all the stuff on my old reformatted machine)
(06-25-2020, 02:44 AM)sodthor Wrote: [ -> ]Ok works fine on emu, I'll test it asap on HW (I need to reinstall all the stuff on my old reformatted machine)

The only other thing I can think to note is that my NGPC has the replacement backlit LCD mod.  It's possible the misbehavior is caused by that.  I don't have a stock ngpc to test on.
I've got 2. I'll test on both.
Nothing obvious in the code (for the moment).
@sodthor did some testing, and confirmed that a stock lcd works fine with combined hblank effects.

My guess is that the timing of the backlit lcd mod is different enough to cause an issue.

The good news is that I figured out that if I add a slight bit of a delay timer (i.e. a while loop that checks timer variable is less than a max and adds to the timer until the condition is not true) at the beginning of the hblank interrupt before any code that affects the display, I can get it to display the effects on the backlit lcd without artifacts at the seams.  I am unsure if such a delay would cause issues on the stock screen, but the emulator I'm using doesn't seem to have an issue with it.

It remains to be seen if I can get acceptable performance on a fully drawn gradient, where every single line on the screen is assigned a background color from a list.  At the moment, doing this is really slowing things down in my game.
Maybe you can change the bg color only every 2 or 4 lines to reduce the slowdown.
in setHBLTimer:
__asm("ldb (TREG0),0x01");
replace 1 by 2 or 4
(06-26-2020, 06:35 PM)sodthor Wrote: [ -> ]Maybe you can change the bg color only every 2 or 4 lines to reduce the slowdown.
in setHBLTimer:
   __asm("ldb  (TREG0),0x01");
replace 1 by 2 or 4

I am getting good performance with only a few colors assigned.  I will have to consider whether or not more gradient effects will be worth it.  As it is, I am happy to get event just a few solid segments of different colors.

Thanks for your help!
Pages: 1 2