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 ?