![]() | ![]() ![]() |
| Home · Downloads · Your Account · Submit News |
|
Documentation Homepage HAMLib reference Back to HAM Homepage |
|
#include "mygba.h" MULTIBOOT
Every HAM based GBA program should start like this. The include line is to make the compiler aware of all the HAM macros and functions available MULTIBOOT should only be set if you want to run this program directly from the RAM of the GBA, instead of from ROM. In most cases you want to delete this line of code, but it can be handy if you are writing programs that need to run form a GBA without a ROM attached (for example if you have a MBV2 but no flash cart).
int main(void)
{
// initialize HAMlib
ham_Init();
Every HAM program starts execution at function main() . After program starts, it is mandatory hat you initialize HAM by calling ham_Init() once. If you do not do this, HAM will not operate correctly.
// init the Text display system on the bg of your choice
ham_InitText(0);
Here we initialize the Text system. We need to do this in order to use the ham_DrawText() function.
// lets draw some text
ham_DrawText(2,10,"HAMlib text display example");
...and now we draw the actual Text to location x=2 and y=10.
while(1)
{
}
}
after that, we halt the program by looping it endlessly in a while loop.
cd samples cd helloworld make vba
Then, change a few lines of code in main.c and retry "make vba". Have fun!