X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain.c;h=e1c3af09595e0e3472c81c2bd166f491fa9ff152;hb=f6bf5b7710b9a695ddaef0ad929796a4e151268e;hp=03930b11e2ee7db5c32013ec2aee5421b79e72d8;hpb=a709333bb82b222e25648f26eb7b76722c4acfcc;p=gbajam21 diff --git a/src/main.c b/src/main.c index 03930b1..e1c3af0 100644 --- a/src/main.c +++ b/src/main.c @@ -2,46 +2,50 @@ #include "gbaregs.h" #include "intr.h" #include "debug.h" - -#include "AAS.h" +#include "game.h" #include "data.h" +#include "maxmod.h" -#define RGB15(r, g, b) \ - (((uint16_t)(r) & 0x1f) | \ - (((uint16_t)(g) & 0x1f) << 5) | \ - (((uint16_t)(b) & 0x1f) << 10)) +static void vblank(void); +static void nopfunc(void); int main(void) { - int i, j; - uint16_t *vptr; - - emuprint("\nStarting GBAJAM21\n-----------------\n"); - intr_init(); - interrupt(INTR_TIMER1, AAS_Timer1InterruptHandler); - AAS_SetConfig(AAS_CONFIG_MIX_24KHZ, AAS_CONFIG_CHANS_8, AAS_CONFIG_SPATIAL_STEREO, AAS_CONFIG_DYNAMIC_ON); - unmask(INTR_TIMER1); - intr_enable(); + REG_WAITCNT = WAITCNT_PREFETCH | WAITCNT_ROM_2_1; +#ifndef NOSOUND + mmInitDefault(sound_data, 8); + mmStart(MOD_POPCORN, MM_PLAY_LOOP); +#endif - REG_DISPCNT = 3 | DISPCNT_BG2; + screen_vblank = nopfunc; - vptr = (uint16_t*)VRAM_START_ADDR; - for(i=0; i<160; i++) { - for(j=0; j<240; j++) { - int xor = i ^ j; - int r = xor >> 2; - int g = xor >> 1; - int b = xor; + intr_disable(); + interrupt(INTR_VBLANK, vblank); + REG_DISPSTAT |= DISPSTAT_IEN_VBLANK; + unmask(INTR_VBLANK); - *vptr++ = RGB15(r, g, b); - } - } - - AAS_MOD_Play(AAS_DATA_MOD_popcorn); + intr_enable(); + gamescr(); for(;;); return 0; } + +static void vblank(void) +{ + vblperf_count++; + + screen_vblank(); + +#ifndef NOSOUND + mmVBlank(); + mmFrame(); +#endif +} + +static void nopfunc(void) +{ +}