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 > SPRITE Attribute 2

#119095 - Risine - Mon Feb 19, 2007 4:50 pm

Well, I'm trying to draw sprites using BankE ( 64Ko VRAM ). Everything's fine as long as I don't put them above 32KO ( ??? )
It seems that the limitation is due to the Sprite index Attribute2, which can only go from 0 to 1024 ( so 0 to 32768 Kb ), because 1 index unit = 32 bytes.
How can work with all the 64Ko?

#119181 - Dark Knight ez - Tue Feb 20, 2007 3:59 pm

In the setVideoMode call, you can also use something such as:
DISPLAY_SPR_1D_SIZE_64

If you OR that define in, an index unit will be 64 bytes.
Some other defines are available as well, so you can change it to whatever you like. (Check some .h file in libnds, probably video.h.)

Of course, all odd (1,3,5,etc) indexes you had with the current setup you use can not be referenced if you start using the 64-bytes index mode instead.

Hope this helps you out.
_________________
AmplituDS website

#119184 - Risine - Tue Feb 20, 2007 4:15 pm

Thanks Dark Knight, just found something similar I presume :
REG_DISPCNT=REG_DISPCNT|0x00100000; to use 64 bytes steps
I'll change it to your define, that's cleaner :)

#119186 - Dark Knight ez - Tue Feb 20, 2007 4:41 pm

Better example:
Code:
DISPLAY_CR = (MODE_0_2D |
                  DISPLAY_BG0_ACTIVE |
                  DISPLAY_SPR_ACTIVE |
                  DISPLAY_SPR_1D |
                  DISPLAY_SPR_1D_BMP |
                  DISPLAY_SPR_1D_SIZE_64
                );

Or if you prefer setVideoMode:
Code:
setVideoMode(MODE_0_2D |
                  DISPLAY_BG0_ACTIVE |
                  DISPLAY_SPR_ACTIVE |
                  DISPLAY_SPR_1D |
                  DISPLAY_SPR_1D_BMP |
                  DISPLAY_SPR_1D_SIZE_64
                );


I think someone once told me that all REG_* defines are old and should not be used.
_________________
AmplituDS website