9b3b0e8a7e1a0bdd291c56335efaeb368eed4b2b
[gbajam21] / src / main.c
1 #include <math.h>
2 #include "gbaregs.h"
3 #include "intr.h"
4 #include "debug.h"
5 #include "game.h"
6 #include "data.h"
7 #include "maxmod.h"
8
9 static void vblank(void);
10
11 int main(void)
12 {
13         intr_init();
14
15         REG_WAITCNT = WAITCNT_PREFETCH | WAITCNT_ROM_2_1;
16
17 #ifndef NOSOUND
18         mmInitDefault(sound_data, 8);
19         mmStart(MOD_POPCORN, MM_PLAY_LOOP);
20 #endif
21
22         intr_disable();
23         interrupt(INTR_VBLANK, vblank);
24         REG_DISPSTAT |= DISPSTAT_IEN_VBLANK;
25         unmask(INTR_VBLANK);
26
27         intr_enable();
28         gamescr();
29
30         for(;;);
31         return 0;
32 }
33
34 static void vblank(void)
35 {
36         vblperf_count++;
37
38 #ifndef NOSOUND
39         mmVBlank();
40         mmFrame();
41 #endif
42 }