#55630 - BrokenMemories - Fri Sep 30, 2005 3:46 am
Okay I'm doing the gbajunkie tutorials but using devkitARM and the header files that come with dkARM.
Now this is the code that comes with the tutorial
relevent (i think) headers stuff
junkiePalette is a .h file with the bin data for an image.
anyways what I gather from this code is that BGPaletteMem is a memory address, right? and then he just pipes the data from junkiePalette straight into it. What I want to know is what is the relative #define in the DevKitARM headers (they are funny to read, sorry for being such a newb)
what does this mean, (form gba_video of dkA libgba)
If I get this right, thats a macro that says what ever 'm' is, do something to 'm' by using <<12. What I want to know is what does <<12 mean. All of the devKitARM headers use it eg
snipit from gba_video.h from libgba of dkA
I'm assuming it is short hand for memory/register addresses, I just dont know how to read it into 0x05000200 etc.
thanks in advance to replys :-)
~BM~
Now this is the code that comes with the tutorial
Code: |
void PlotPixel(int x,int y, unsigned short int c) { VideoBuffer[(y) * 120 + (x)] = (c); } int main() { int loop; int x, y; SetMode(MODE_4 | BG2_ENABLE); //set mode 4 and enable background 2 for(loop = 0; loop < 256; loop++) //256 entries allowed BGPaletteMem[loop] = junkiePalette[loop]; //load the palette into palette memory while(1) { for(y = 0; y < 160; y++) //screen height { for(x = 0; x < 120; x++) //screen width { PlotPixel(x,y, junkieData[y*120+x]); //load image data into } //memory pixel by pixel } } } |
relevent (i think) headers stuff
Code: |
u16* BGPaletteMem =(u16*)0x5000000; u16* VideoBuffer =(u16*)0x6000000; |
junkiePalette is a .h file with the bin data for an image.
anyways what I gather from this code is that BGPaletteMem is a memory address, right? and then he just pipes the data from junkiePalette straight into it. What I want to know is what is the relative #define in the DevKitARM headers (they are funny to read, sorry for being such a newb)
what does this mean, (form gba_video of dkA libgba)
Code: |
#define BG_PALETTE(m) ((m)<<12) |
If I get this right, thats a macro that says what ever 'm' is, do something to 'm' by using <<12. What I want to know is what does <<12 mean. All of the devKitARM headers use it eg
snipit from gba_video.h from libgba of dkA
Code: |
#define BACKBUFFER (1<<4) // buffer display select #define OBJ_1D_MAP (1<<6) // sprite 1 dimensional mapping #define LCDC_OFF (1<<7) // LCDC OFF |
I'm assuming it is short hand for memory/register addresses, I just dont know how to read it into 0x05000200 etc.
thanks in advance to replys :-)
~BM~