#144482 - Echo49 - Fri Nov 02, 2007 7:37 pm
I've just started looking at DS programming and there's one thing that bothers me. The DS can have a maximum of 256KB of memory for sprites on the main screen, right? That means 4096 8x8 tiles.
From what I can see, you set the first tile of the sprite in attribute 2 of the OAM. However, there are only 10 bits available, which means only 1024 tiles, or 64KB worth of data max?
What have I missed?
#144486 - ingramb - Fri Nov 02, 2007 9:41 pm
Take a look at http://nocash.emubase.de/gbatek.htm.
By default, each of the 1024 indices indexes 32 bytes of data. But this can be increased to 256. So if you use more sprite vram, you lose some resolution in your sprite tiles.
#144487 - sajiimori - Fri Nov 02, 2007 9:55 pm
To clarify a bit, using a larger char region size causes some waste when your allocation isn't an even multiple of regions.
So if you increase the region size to 8 chars (to access up to 256K of sprite VRAM), and you'd like to allocate 12 chars, you actually have to round up to 16 and waste 4 chars.
#144504 - Echo49 - Sat Nov 03, 2007 2:39 am
I'm still a bit confused. Does this mean, for example, if I have two 16x16 sprites with DISPLAY_SPR_1D and DISPLAY_SPR_1D_SIZE_256 set, then I set the tile number in attribute2 to 0 and 1 for the two sprites, but if I have DISPLAY_SPR_1D_SIZE_128 set instead, then I use 0 and 2 respectively?
#144523 - mml - Sat Nov 03, 2007 6:08 am
Pretty much, yes.