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.

Beginners > Busting out memory ???

#16024 - doudou - Fri Feb 06, 2004 2:44 pm

I have a strange behavior in my rom. I have some ressources included in my rom (not that much since my .gba is ~300k) and now, when I want to use some more space, the Visual Boy emulator shows me absolultly nothing...the OAM, tile, palette...all is empty (black).

I can even tell the exact limit of when I "bust out" memory. When I try

char test[1808];

everithing is ok, but with

char test[1809];

that's it, nothing works.

Help !!!

#16025 - tepples - Fri Feb 06, 2004 3:15 pm

How have you included resources in your ROM? If through something like bin2h, bin2s, or bin2o, have you made sure to put them in the .rodata segment (in C, do this by declaring them const)?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#16026 - poslundc - Fri Feb 06, 2004 4:07 pm

Just to expand on tepples' post: you've only got 32K of IWRAM, and that's where all of the C variables you declare go. If your arrays, etc. are too large then you will run out of memory quickly.

So, any read-only "resources" you want to create in C should all be declared as const, to put them in ROM instead of IWRAM.

Dan.

#16030 - doudou - Fri Feb 06, 2004 7:43 pm

The const declaration did the job. Thank you