X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fgba%2Fmain.c;fp=src%2Fgba%2Fmain.c;h=068f3d1f8daf10a3e74ed5671303c48a660f767c;hb=097d03fa2406fca819b27b698ffb1cfc8ac445c2;hp=0000000000000000000000000000000000000000;hpb=0ff927162004fe6b5d0022000284a1bdb306960e;p=gbajam22 diff --git a/src/gba/main.c b/src/gba/main.c new file mode 100644 index 0000000..068f3d1 --- /dev/null +++ b/src/gba/main.c @@ -0,0 +1,59 @@ +#include +#include "gbaregs.h" +#include "intr.h" +#include "debug.h" +#include "game.h" +#include "maxmod.h" + +static void vblank(void); +static void nopfunc(void); + +int main(void) +{ + int i; + volatile uint16_t *cptr; + + intr_init(); + + REG_WAITCNT = WAITCNT_PREFETCH | WAITCNT_ROM_2_1; + + cptr = (uint16_t*)CRAM_BG_ADDR; + for(i=0; i<256; i++) { + int c = i >> 3; + *cptr++ = c | ((c >> 1) << 10); + } + +#ifndef NOSOUND + mmInitDefault(sound_data, 8); + mmStart(MOD_POPCORN, MM_PLAY_LOOP); +#endif + + screen_vblank = nopfunc; + + intr_disable(); + interrupt(INTR_VBLANK, vblank); + REG_DISPSTAT |= DISPSTAT_IEN_VBLANK; + unmask(INTR_VBLANK); + + intr_enable(); + gamescr(); + + for(;;); + return 0; +} + +static void vblank(void) +{ + vblperf_count++; + + screen_vblank(); + +#ifndef NOSOUND + mmVBlank(); + mmFrame(); +#endif +} + +static void nopfunc(void) +{ +}