X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fdebug.c;h=d4c2426fc6f93a1758b6ea1e3d06cffd46c46f05;hb=e2ed633cc1ea03fcc73d862adfc154cbfb3a537c;hp=14e00c0d3c328210113822d1779c08ee8aeaa6e4;hpb=4f58871ec2e25fb8cd7dfc19d1e4999453cf9555;p=gbajam21 diff --git a/src/debug.c b/src/debug.c index 14e00c0..d4c2426 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1,7 +1,35 @@ #include #include +#include "gbaregs.h" +#include "intr.h" #include "debug.h" +uint16_t vblperf_color[] = {0x3e0, 0xffc0, 0x3ff, 0x1ff, 0x001f, 0xf81f}; + +static void vblperf_intr(void) +{ + vblperf_count++; +} + +void vblperf_start(int palidx) +{ + vblperf_palptr = (uint16_t*)CRAM_BG_ADDR + palidx; + intr_disable(); + REG_DISPSTAT |= DISPSTAT_IEN_VBLANK; + interrupt(INTR_VBLANK, vblperf_intr); + unmask(INTR_VBLANK); + intr_enable(); +} + +void vblperf_stop(void) +{ + intr_disable(); + REG_DISPSTAT &= ~DISPSTAT_IEN_VBLANK; + interrupt(INTR_VBLANK, 0); + mask(INTR_VBLANK); + intr_enable(); +} + #ifdef EMUBUILD __attribute__((target("arm"))) void emuprint(const char *fmt, ...)