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.

C/C++ > Unknown problem

#10802 - Davix - Tue Sep 16, 2003 12:32 pm

Hi,

my project compile well (VC6/devkitadv) but when i try it (mappy/visualboy advance) seems to be hanged..
this is not the first try, i'm working on this project from months and everything go well.. now i have to add an array of 300 signed byte and here starts my problem (removing the array declaration everything works well!) ..

anyone knows if there is some memory limit on gba??
or some keyword to be specified when allocating (maybe memory alignment??) large array of data (graphics, generic data..)

Don't know if I was clear enough.. but i hope someone can help me.

Davix.

#10804 - Cyberman - Tue Sep 16, 2003 2:57 pm

It really depends on where you declare your array.

Things to look out for.
Arrays of constant data (sprit data background data bitmaps etc), that aren't declared CONST, be certain you do that (or you will have a miserable time of things).

Where did you declare? Was it globaly in a module (say main.c?) or was it locally in a function if the later, you should be careful about declaring large temporary arrays. This tends to use IRAM (which can be a problem).

Are you using malloc() or the new operator? if it's in a function.. is that function called multiple times and is the memory deallocated?

If the array of int8's are constants, don't do this, put them in an array of type const. If you are using something to compute the array on start up, don't do this either, compute them and store them in an array of const :)

In any case a code snipet might be helpful of your declaration and where it is in your program as a whole.


Cyb
_________________
If at first you don't succeed parachuting is NOT for you.

#10809 - Davix - Tue Sep 16, 2003 4:26 pm

Wow! How many arrays not declared as CONST!

It's the cause of my troubles!

thank you Cyb for very useful help!

Davix.