foo
[gbajam21] / src / gamescr.c
index e5dd8e4..8ce610e 100644 (file)
@@ -7,8 +7,6 @@
 #include "intr.h"
 #include "debug.h"
 
-static unsigned char tex[32 * 32] __attribute__((section(".iwram")));
-
 void gamescr(void)
 {
        int i, j, tx, ty, angle, depth, nframes, backbuf, zoffs;
@@ -16,6 +14,7 @@ void gamescr(void)
        uint16_t *cdst, *top, *bot;
        unsigned char *csrc;
        uint32_t tun, *tunptr;
+       unsigned char *tex;
 
        REG_DISPCNT = 4 | DISPCNT_BG2 | DISPCNT_FB1;
 
@@ -31,6 +30,7 @@ void gamescr(void)
        fillblock_16byte(vram[0], 0xffffffff, 240 * 160 / 16);
        fillblock_16byte(vram[1], 0xffffffff, 240 * 160 / 16);
 
+       tex = iwram_sbrk(32 * 32);
        memcpy(tex, tuncross_pixels, 32 * 32);
 
        nframes = 0;
@@ -43,7 +43,10 @@ void gamescr(void)
                bot = vram[backbuf] + 159 * 240 / 2;
                tunptr = tunmap;
                for(i=0; i<80; i++) {
-                       for(j=0; j<240/2; j++) {
+                       top++;
+                       bot++;
+                       tunptr++;
+                       for(j=1; j<240/2; j++) {
                                uint16_t pptop, ppbot;
 
                                tun = *tunptr++;