GP32 Implementing Vbl On Mirko's Sdk


Arda

Member
Joined
Jul 16, 2003
Messages
142
Location
istanbul
Website
arda.kisafilm.org
I examined mr.Spiv's Vertical Blanking emulator and came up an idea of requesting a waitVbl() fuction from mirko :)

it's hard for me to adapt spiv's code to my program, I just wish that a command that wait for vertical blanking.

I'm writing a program and there are sprites and bacground animation, but even I use double buffering there is still flicker.

I'm now using timers to limit framerate to *reduce* flicker, every once a while there is tearing/flickering. Is there any other way to eliminate flicker?

-I am using double buffering, yes. but at 300fps double buffer won't do anything.-
 
i looked into mr. spiv's code and wrote a waitvbl. i cant test it right now but i think it should work:
Code:
#define lastline 319  //dont really know if its 319 or 239
void waitvbl() { //modified waitline function
  while (lastline != ((*lcdcon1 >> 18) & 0x1ff) );
  while (lastline == ((*lcdcon1 >> 18) & 0x1ff) ); //loop until lastline finished
}

i hope it works like it should :unsure:
 
Saotome posted on Mar 21 2004 at 09:48 PM said:
i looked into mr. spiv's code and wrote a waitvbl. i cant test it right now but i think it should work:
Code:
#define lastline 319  //dont really know if its 319 or 239
void waitvbl() { //modified waitline function
  while (lastline != ((*lcdcon1 >> 18) & 0x1ff) );
  while (lastline == ((*lcdcon1 >> 18) & 0x1ff) ); //loop until lastline finished
}

i hope it works like it should :unsure:
Actually the last line is 0.. Lines count from 319 to 0 i.e. in descending order.
 
Last edited by a moderator:
Basically yes.. I would wait for line 1 instead on 0.. because then I would have ~rasterline time to change LCD registers etc.
 
edit: I removed whole entry because we found a way (Thank's to Mr.spiv):

on mirko's sdk you can use:

Code:
void WaitVBlank() {
   while ((rLCDCON1 >> 18) != 2);
   while ((rLCDCON1 >> 18) != 1);
 }

use WaitVBlank() before gp_SetView.
I tested it and it works.
 
just the code i was looking for, sadly it wont work with the MiniGP32 SDK :p

moans that it doesn't have a clue what 'rLCDCON1' is :D
 
Back
Top