Failed sprite allocation with oamAllocateGfx
Posted: Mon Mar 21, 2011 12:35 am
Hi,
I have a problem concerning allocation of gfx memory for sprites. Consider the following code:
which leads to the following output:
I see that VRAM bank B is 128kB in size which should be sufficient to hold 9 sprites of the given size and color format !?
Why can't I allocate more than 8 sprites? Can anyone tell me what I have overseen ?
I have a problem concerning allocation of gfx memory for sprites. Consider the following code:
Code: Select all
#include <nds.h>
#include <stdio.h>
int main()
{
int i;
u16* gfx[9];
consoleDemoInit();
vramSetBankA(VRAM_A_MAIN_BG);
vramSetBankB(VRAM_B_MAIN_SPRITE);
videoSetMode(MODE_5_2D);
bgInit(3,BgType_Bmp8,BgSize_B8_256x256, 0,0);
oamInit(&oamMain, SpriteMapping_1D_32, false);
for( i=0; i < 9; i++ ) {
gfx[i] = oamAllocateGfx(&oamMain,SpriteSize_64x64,SpriteColorFormat_256Color);
if( gfx[i] == NULL ) {
iprintf("CANT ALLOCATE \n");
while(1) swiWaitForVBlank();
}
iprintf("%p \n",gfx[i]);
}
while(1) swiWaitForVBlank();
return 0;
}
Code: Select all
0x6400000
0x6401000
0x6402000
0x6403000
0x6404000
0x6405000
0x6406000
0x6407000
CANT ALLOCATE
Why can't I allocate more than 8 sprites? Can anyone tell me what I have overseen ?