writing directly to the sub engine's framebuffer.
Posted: Thu Jun 02, 2011 3:14 pm
So I am following the nds graphics tutorial at dev-scene. They have a code snippet which demonstrates how to fill the top screen's frame buffer with a red color. As a test, I wanted to do the same thing but for the bottom screen. I read that the ds has 2 graphics engine, 1 for the top screen (Main engine) and 1 for the bottom screen (Sub engine). I also read that you can make either engine use any combo of the vram memory. So I wrote the following example.
This doesn't seem to fill the bottom screen with a red color. What am I doing wrong? Thanks!
Code: Select all
#include <nds.h>
#include <stdio.h>
int main(void)
{
//set frame buffer mode 0
videoSetModeSub(MODE_FB0);
//enable VRAM A for writing by the cpu and use
//as a framebuffer by video hardware
vramSetBankA(VRAM_A_LCD);
//fill video memory with the chosen color
for(i = 0; i < 256*192; i++)
VRAM_A[i] = RGB15(31,0,0);
while(1)
{
swiWaitForVBlank();
}
return 0;
}