gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Using More Object VRAM

#137372 - The_Perfection - Fri Aug 10, 2007 11:36 pm

Hello all. I'm attempting to use VRAM bank E for main OVRAM. Now, this gives me 64Kb, right? How do I use it all? As far as I can tell, I can still only put the tile index of a sprite to 1023, which should get me an extra 63 tiles if I place 8t*8t data right on that boundry. Is there a way to use the other half of the data bank?

I have set my OVRAM to be used in 1D mode as well as the 64Kb mode (as specified by GBATek).

Yay.

#137375 - josath - Sat Aug 11, 2007 12:09 am

See here:
http://nocash.emubase.de/gbatek.htm#dsvideoobjs

TileVramAddress = TileNumber * BoundaryValue

so you basically want to set the bits to get a bigger boundryValue, to access more vram. Engine A can use up to 256KB, Engine B only 128KB

#137416 - The_Perfection - Sat Aug 11, 2007 5:37 pm

josath wrote:
TileVramAddress = TileNumber * BoundaryValue

I think I understand that much. (That's just getting the address to put data, right?)

What I'm talking about is the objects attribute 2. The tile index number can only go up to 1023, can't it? Or has that changed? 'Cuz if it only goes up to 1023, what's the point in allocating more than 32KB for it?

#137422 - Cearn - Sat Aug 11, 2007 6:33 pm

The_Perfection wrote:
josath wrote:
TileVramAddress = TileNumber * BoundaryValue

I think I understand that much. (That's just getting the address to put data, right?)

What I'm talking about is the objects attribute 2. The tile index number can only go up to 1023, can't it? Or has that changed? 'Cuz if it only goes up to 1023, what's the point in allocating more than 32KB for it?

As far as I understand it, there are still 10 bits, but the indexing has been changed. With, say, DISPLAY_SPR_1D_SIZE_64, you count in units of 64 bytes, not 32. Effectively, you'd be counting in 8bpp tiles instead of 4bpp tiles.

#137426 - Lordus - Sat Aug 11, 2007 6:51 pm

Example:
if you want to display 128 32x32 sprites in 4bit depth, you would need

16tiles*32bytes = 512bytes/sprite

now you could set the tile index in attribute2 to 0,16,32,... and write the tile data to 0, 512, 1024, ...

so with 32kb you could just display 64 sprites maximum.

If you specify DISPLAY_SPR_1D_SIZE_64 and still write the tile data to 0, 512, 1024, you would have to set the tile index in attribute2 to 0, 8, 16, ...
and the 2d engine will then still use the right offsets, because of the specified boundary. This way you can effectively use 64kb for tile data.

#137434 - The_Perfection - Sat Aug 11, 2007 8:39 pm

Cearn wrote:
With, say, DISPLAY_SPR_1D_SIZE_64, you count in units of 64 bytes, not 32.

So, in 32K mode, you would count in 1 s-tile increments, 64K mode, 2 s-tiles, 128K, 4 s-tiles, and 256K, 8 s-tiles? That makes sense... sorta. But it also limits some things. Like not being able to set an 8*8 sprite to s-tile 1. I think.

Well, if that is indeed the case, looks like I'll have to waste some VRAM then.

Thanks for all the help!