#include #include "common.h" #include "gba-buttons.c" #include "background-tiles.c" #include "sprites.h" #include "text.h" // // Main functions. // // TODO: Cleanup OBJ/OAM memory copying and access. // // // BIOS calls // int bios_vblank_wait(); int bios_div(int num, int denom); int hblank_counter = 0; void irs_hblank_func() { u16 clr = (DISP_VCOUNT / 8); PAL_BUFFER_BG[0] = rgb15(clr, 0, 31 - clr); hblank_counter++; } int main(void) { // Configure the display in mode 0 to show OBJs, where tile memory is // sequential. DISP_CTRL = DISP_ENABLE_SPRITES | DISP_MODE_0 | DISP_BG_0; // Initialize sprite button overlay. init_sprite_pal(0, COLOR_WHITE); init_sprites(0); init_button_sprites(); // Initialize text engine. txt_init(0, COLOR_RED, 0); // Register interrupts. irq_init(); irs_set(IRQ_HBLANK, irs_hblank_func); int frame_counter = 0; while(true) { // bios_vblank_wait(); wait_vsync(); poll_keys(); txt_position(0, 1); txt_clear_line(); txt_printf(" HBlank counter: %d\n", hblank_counter); txt_clear_line(); txt_printf(" Frame counter: %d", frame_counter); frame_counter++; // update_button_sprites(); }; return 0; }