#11513 - poslundc - Thu Oct 09, 2003 2:21 am
Does anyone know if REG_VCOUNT behaves differently on hardware than in emulation, in particular relating to the interlaced nature of the screen?
I've been trying to do a simple gradient ("sky") by changing a palette colour from the top of the screen to the bottom of the screen. I'm using HBlank interrupts and REG_VCOUNT to determine what colour to use.
It works fine in emulation, but on hardware the very first scanline flickers for the first 30 pixels or so.
I experimentally set it up so that it wouldn't start changing the background colour until the 10th line. Now the first ten lines flicker alternately (ie. interlaced), and the 11th line behaves the way the first line did before.
Here's the interrupt code:
Simple enough, huh? And it behaves as expected in emulation, but on hardware those first ten lines BEFORE it starts actually doing anything mysteriously flicker.
Because the flicker is interlaced I thought it might have something to do with how the GBA processes HBlank interrupts and calculates VCOUNT. Can anyone enlighten me?
Thanks,
Dan.
I've been trying to do a simple gradient ("sky") by changing a palette colour from the top of the screen to the bottom of the screen. I'm using HBlank interrupts and REG_VCOUNT to determine what colour to use.
It works fine in emulation, but on hardware the very first scanline flickers for the first 30 pixels or so.
I experimentally set it up so that it wouldn't start changing the background colour until the 10th line. Now the first ten lines flicker alternately (ie. interlaced), and the 11th line behaves the way the first line did before.
Here's the interrupt code:
Code: |
skyLevel = gCamera.horizon - REG_VCOUNT + 1; if ((REG_VCOUNT > 10) && (gCamera.horizon > REG_VCOUNT)) { BGPaletteMem[gSkyColourIndex] = gSkyValues[skyLevel]; } |
Simple enough, huh? And it behaves as expected in emulation, but on hardware those first ten lines BEFORE it starts actually doing anything mysteriously flicker.
Because the flicker is interlaced I thought it might have something to do with how the GBA processes HBlank interrupts and calculates VCOUNT. Can anyone enlighten me?
Thanks,
Dan.