X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fgamescr.c;h=4c7d6bae8745a7e94851a6b89c49f65801f17cdc;hb=e2ed633cc1ea03fcc73d862adfc154cbfb3a537c;hp=330331eb63450429cd8965d2fffb6f3b8967f688;hpb=4f58871ec2e25fb8cd7dfc19d1e4999453cf9555;p=gbajam21 diff --git a/src/gamescr.c b/src/gamescr.c index 330331e..4c7d6ba 100644 --- a/src/gamescr.c +++ b/src/gamescr.c @@ -2,14 +2,10 @@ #include "gbaregs.h" #include "dma.h" #include "data.h" +#include "util.h" +#include "intr.h" #include "debug.h" -#define present(x) \ - do { \ - REG_DISPCNT = DISPCNT_BG2 | 4 | ((x) << 4); \ - } while(0) - - void gamescr(void) { int i, j, tx, ty, angle, depth, nframes, backbuf, zoffs; @@ -20,6 +16,8 @@ void gamescr(void) REG_DISPCNT = 4 | DISPCNT_BG2 | DISPCNT_FB1; + vblperf_start(0xff); + cdst = (uint16_t*)CRAM_BG_ADDR; csrc = tuncross_cmap; for(i=0; i<256; i++) { @@ -27,6 +25,9 @@ void gamescr(void) csrc += 3; } + dma_fill16(3, vram[0], 0xffff, 240 * 160 / 2); + dma_fill16(3, vram[1], 0xffff, 240 * 160 / 2); + nframes = 0; for(;;) { backbuf = ++nframes & 1; @@ -36,7 +37,9 @@ void gamescr(void) cdst = vram[backbuf]; tunptr = tunmap; for(i=0; i<160; i++) { - for(j=0; j<240/2; j++) { + cdst++; + tunptr += 2; + for(j=1; j<240/2; j++) { uint16_t pp; tun = *tunptr++; @@ -57,9 +60,9 @@ void gamescr(void) } } - //while(!(REG_DISPSTAT & DISPSTAT_VBLANK)); - while(REG_VCOUNT < 160); - //REG_DISPCNT ^= DISPCNT_FB1; + vblperf_end(); + wait_vblank(); present(backbuf); + vblperf_start(); } }