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 > Not enough memory

#145750 - kiwicode - Wed Nov 21, 2007 2:27 pm

Hi all,

this is the situation:
[Images not permitted - Click here to view it]

I need to display onto the subscreen two different layers. I'm using a palette so I can easely activate SUB_BG2 and SUB_BG3 since
( 256 * 192 * 1 ) * 2 < 128 kb.

The problem is that I need other 48 kb in order to enable double buffering for at least one of the two layers. I don't know where could I find this 48 kb: do you know any shortcut or idea to get through this problem?
( I've already used all the sprites ) .

Thanks in advance

#145762 - Lick - Wed Nov 21, 2007 7:21 pm

If you haven't got any VRAM banks left to set as SUB_BG memory, then try using the Main RAM? Not really sure how big the performance difference is, though I'm almost sure that it's not really noticable/slowing down on hardware.
_________________
http://licklick.wordpress.com

#145766 - NeX - Wed Nov 21, 2007 8:05 pm

Why, may I ask, do you feel the need to double buffer?
_________________
Strummer or Drummer?.
Or maybe you would rather play with sand? Sandscape is for you in that case.

#145782 - kiwicode - Thu Nov 22, 2007 9:09 am

I must use the sub screen since I need the pen as input.

I've already used all the 128 sprites, so to render new things on screen I need to change memory data directly in that way:

frameBuffer[ y * 256 + x >> 1 ] = 1 | ( 1 << 8 );

This way sounds pretty bad for perfomance so I thought that using double buffering was a good solution.

#145783 - Jesse - Thu Nov 22, 2007 10:31 am

You don't have to use the sub-screen just because you want to use the lower-screen. Just call lcdMainOnBottom(); and the screens will be flipped and you will be able to use more VRAM for the lower screen.
_________________
http://www.collectingsmiles.com/colors & http://www.collectingsmiles.com/hyena