> i've been looking at various gba.h files and have a question about setting
up
> memory locations. I've notived 3 main ways people are doing this....
>
> #define OBJPaletteMem 0x5000200
Using this method you have an integer which still needs to be casted to a
pointer, so if you want to change color entry 0 to white, you'd do:
(u16*)OBJPaletteMem[0] = 0x7FFF;
or
*(u16*)OBJPaletteMem = 0x7FFF;
This method requires some extra typing as you can see, but you can see the
access size in your code.
> #define OBJPaletteMem (u16*)0x5000200
This is the same as above but saves typing:
OBJPaletteMem[0] = 0x7FFF;
or
*OBJPaletteMem = 0x7FFF;
> u16* OBJPaletteMem = (u16*)0x5000200;
This method will generate the same code as the others in an optimized build
(it might give you some overhead in a non-optimized build). I would say: use
a #define so that your code will be more readable. Up to you whether you
want to do the typecast in your code or within the macro.
Jan-Lieuwe