Multiple extended BGs -- order of copying data
Posted: Tue Mar 29, 2011 10:51 pm
Hi,
in the following small program I set up two bitmap BGs, scrolling them so I can see them side by side:
Now, while BG no.2 is fine, BG no.1 shows junk. Swapping the last two dmaCopy calls, both BGs are fine.
Can someone tell me why the order of copying data is important here?
in the following small program I set up two bitmap BGs, scrolling them so I can see them side by side:
Code: Select all
#include <nds.h>
#include <stdio.h>
#include "gfx.h"
int main()
{
vramSetBankA(VRAM_A_MAIN_BG);
videoSetMode(MODE_5_2D);
int bg1 = bgInit(3,BgType_Bmp8,BgSize_B8_256x256, 0,0);
int bg2 = bgInit(2,BgType_Bmp8,BgSize_B8_256x256, 4,0);
bgSetScroll(bg2,-SCREEN_WIDTH/2,0);
bgSetScroll(bg1,SCREEN_WIDTH/2,0);
bgUpdate();
dmaCopy( gfxPal, BG_PALETTE, gfxPalLen );
dmaCopy( gfxBitmap, bgGetGfxPtr(bg2), gfxBitmapLen*2 );
dmaCopy( gfxBitmap, bgGetGfxPtr(bg1), gfxBitmapLen*2 );
while(1) swiWaitForVBlank();
}
Can someone tell me why the order of copying data is important here?