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 memory question.

#148504 - nipil - Sun Jan 06, 2008 4:34 pm

Good day to you, i'm having some questions about sprite banks' use :

According to the defines in video.h, you ca use the following banks :
- MAIN_SPRITE : A, B, E, F, G (total 336KB)
- SUB_SPRITE : D, I (total 144KB)

As you can see, total differs from main and sub engines. My questions are :

- are we supposed to do most of the 2d work on the "main" ?

- is there a way to use let's say bank B on sub, or C on any ?

- and finally can we share a bank on both to avoid loading the same sprites twice ?

Any hint would make me happy =)


Last edited by nipil on Sun Jan 06, 2008 7:26 pm; edited 1 time in total

#148506 - simonjhall - Sun Jan 06, 2008 4:42 pm

If you've not yet seen it, have a look at:
http://nocash.emubase.de/gbatek.htm#dsvideodisplaysystemblockdiagram
This shows which banks are can be used by both (look down the left). That doesn't necessarily mean though that you can assign one bank to both engines though! Sorry but I don't really know much about the 2D hardware so I can't be sure about this. DS 3D, however ;-)
_________________
Big thanks to everyone who donated for Quake2

#148512 - wintermute - Sun Jan 06, 2008 5:05 pm

nipil wrote:

According to the defines in video.h, you ca use the following banks :
- MAIN_SPRITE : A, B, E, G (total 336KB)
- SUB_SPRITE : D, I (total 144KB)


Those defines aren't quite right - we still have to remove some that don't actually work. You can only assign 128K to engine B.

Quote:

- are we supposed to do most of the 2d work on the "main" ?


Not necessarily, you're just a little more limited on engine B.

Quote:

- is there a way to use let's say bank B on sub, or C on any ?


No.

Quote:

- and finally can we share a bank on both to avoid loading the same sprites twice ?


No.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#148518 - nipil - Sun Jan 06, 2008 5:51 pm

Thanks a lot for these answers.
Clear, fast and efficient ;)
Good evening !

#148522 - wintermute - Sun Jan 06, 2008 6:34 pm

Just found the other doc I was looking for, it's a little clearer than gbatek about what VRAM banks can be used for.

http://dualis.1emu.net/dsti.html#lcdiovramcnt
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#148524 - nipil - Sun Jan 06, 2008 7:26 pm

In this doc, the possible MAIN/SUB_SPRITE banks are the similar to those i listed (when looking at the Main/Sub OBJ function)...
And when you say only 128K of sprites memory can be allocated to engine B (only bank "D"), then "I" shouldn't show up a Sub OBJ...

Gah. That thing is complicated. But i'll get it, one day.

PS: now i understand there's so much (example) code using the fb mode ;)

PPS: i added the missing "F" bank to MAIN_SPRITE in my first post

#148535 - tepples - Sun Jan 06, 2008 10:31 pm

nipil wrote:
In this doc, the possible MAIN/SUB_SPRITE banks are the similar to those i listed (when looking at the Main/Sub OBJ function)...
And when you say only 128K of sprites memory can be allocated to engine B (only bank "D"), then "I" shouldn't show up a Sub OBJ...

The point is that you can use either D or I. If you're using D for textures on the 3D core, you can use I for sprites on sub. In 3D mode, one common layout I've seen is
  1. Textures (128 KiB)
  2. Textures (128 KiB)
  3. Textures (128 KiB)
  4. Textures (128 KiB)
  5. Texture palettes (64 KiB)
  6. Main background (16 KiB)
  7. Main sprites (16 KiB)
  8. Sub background (32 KiB)
  9. Sub sprites (16 KiB)

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#148537 - wintermute - Sun Jan 06, 2008 10:42 pm

nipil wrote:

And when you say only 128K of sprites memory can be allocated to engine B (only bank "D"), then "I" shouldn't show up a Sub OBJ...


Note the VRAM addresses those banks can be mapped to - you can either have 128K of sprite memory from bank D or 16k from bank I. They're mutually exclusive.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#148539 - nipil - Sun Jan 06, 2008 10:46 pm

Right, i didn't look at the adresses, which are the same for D and I... I think i like this toy more and more. There's always something to discover =)