int main() {
*(unsigned int*)0x04000000 = 0x403;
((unsigned short*)0x06000000)[120+80*240] = 0x001F;
while(1);
return 0;
}
Is perfectly legal. If you don't understand this source code its fine. 0x04000000 is the IO MEM location. Its used to set info to the gba. 0x403 means display mode 3 which is bitmap mode 1 using background 2. 0x06000000 is the location of the video ram (VRAM) which alows you to display stuff the gba's display. This example display a red dot at [120x80] pixels. The code is quite unreadable if I say my self, usually you would write a library to make this more manageable (I'm working on my own right now). I"m just demonstrating how low-level console development is. There are libraries out there to hide this like devkitpro's libgba or tonc's (This example is a simplified version of toncs hello world program).
Kind of boring but hell this is my first blog post after all.
Also note to compile this you need a compiler that compiles to arm and thumb code. I'm using devkit pro's arm compile stack which is the default stack now a days here the link.
http://sourceforge.net/projects/devkitpro/files/devkitARM/
Here's the demo link if it disappears let me know I'll re-up it.
http://www.filehosting.org/
Oh well this was kind of long for a hello world post. Well later.
No comments:
Post a Comment