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.

Coding > Starting/Stopping HDMA at a certain scanlines?

#109050 - Dwedit - Tue Nov 14, 2006 3:29 pm

Let's say you want to start HDMA at scanline 8, and stop HDMA at scanline 152. What I'm wondering about is whether the VCOUNT interrupt triggers before or after the HDMA would transfer. Would I use VCOUNT=8 to transfer in scroll data before the eighth scanline draws, or use 7, or 9? Would I use VCOUNT=152 and stop the DMA, or use a different value?
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#109051 - sgeos - Tue Nov 14, 2006 3:44 pm

This is fairly easy to test.

hdmaPaletteTable[0] = BLACK;
... // BLACK
hdmaPaletteTable[6] = BLACK;
hdmaPaletteTable[7] = RED;
hdmaPaletteTable[8] = GREEN;
hdmaPaletteTable[9] = YELLOW;
hdmaPaletteTable[10] = BLACK;
... // BLACK
hdmaPaletteTable[149] = BLACK;
hdmaPaletteTable[150] = YELLOW;
hdmaPaletteTable[151] = GREEN;
hdmaPaletteTable[152] = RED;
hdmaPaletteTable[153] = BLACK;
... // BLACK
hdmaPaletteTable[LAST_ENTRY] = BLACK;

Use HDMA to copy this data to bgPalette[0]
and visually check the output.

-Brendan

#109061 - poslundc - Tue Nov 14, 2006 5:50 pm

Dwedit wrote:
Let's say you want to start HDMA at scanline 8, and stop HDMA at scanline 152. What I'm wondering about is whether the VCOUNT interrupt triggers before or after the HDMA would transfer. Would I use VCOUNT=8 to transfer in scroll data before the eighth scanline draws, or use 7, or 9? Would I use VCOUNT=152 and stop the DMA, or use a different value?


HBlank is at the end of a scanline, so VCount triggers before it.

So if you want a change to be on 8th scanline, you would use VCount = 7 when setting up your HDMA.

Dan.