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.
DS development > How to absolute clear a vbank?
#152559 - Programix - Mon Mar 17, 2008 7:49 pm
Hi, what's the easiest way to clear a vram bank or clear all vram banks?
Thanks in advance :) _________________ My blog
#152564 - simonjhall - Mon Mar 17, 2008 8:47 pm
Aren't they clear with to begin? If not, what I'd do is map each bank in turn to LCDC mode (so you can write to it directly from the ARM9). Then for each bank fill it with zeros!
However remember that you can only write to VRAM in 16-bit quantities so do each clear as a for/while loop that writes shorts (not bytes) to the appropriate piece of memory. _________________ Big thanks to everyone who donated for Quake2
#152566 - Programix - Mon Mar 17, 2008 8:51 pm
Thanks much simonjhall! I will try it out _________________ My blog
#152572 - Dwedit - Mon Mar 17, 2008 9:37 pm
You can write 32-bit quantities into VRAM, it just runs at a speed as if you were doing 2 16-bit writes. But that loses the instruction overhead of doing multiple 16-bit writes, so doing a bunch of 32-bit writes is the fastest way to go.
In other words, if you're the programmer, use memset. _________________ "We are merely sprites that dance at the beck and call of our button pressing overlord."