gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > HBlank

#52902 - QuantumDoja - Sun Sep 04, 2005 2:45 pm

Hi, how do/can i tell when hblank is occuring as i need to do some process while its occuring....I have code like this for my vsync

Code:

void WaitForVsync() {
   while((volatile u16)REG_VCOUNT == 160) {}
   while((volatile u16)REG_VCOUNT != 160) {}
}


i guess im after some code like:

Code:

void WaitForHBlank() {
   //do extra processing
}

_________________
Chris Davis

#52979 - Cearn - Mon Sep 05, 2005 8:12 am

REG_DISPSTAT, bit 1. Either that or use HBlank interrupts.

#53181 - poslundc - Tue Sep 06, 2005 4:56 pm

In practice, you will either need to write an interrupt service routine, or set up a DMA to automatically trigger on HBlank and copy the necessary data (which effectively limits you to one "effect").

Dan.