10 static unsigned char *tex;//[32 * 32] __attribute__((section(".iwram")));
14 int i, j, tx, ty, angle, depth, nframes, backbuf, zoffs;
15 static uint16_t *vram[] = { (uint16_t*)VRAM_LFB_FB0_ADDR, (uint16_t*)VRAM_LFB_FB1_ADDR };
16 uint16_t *cdst, *top, *bot;
18 uint32_t tun, *tunptr;
20 REG_DISPCNT = 4 | DISPCNT_BG2 | DISPCNT_FB1;
24 cdst = (uint16_t*)CRAM_BG_ADDR;
26 for(i=0; i<256; i++) {
27 *cdst++ = CONV_RGB24_RGB15(csrc[0], csrc[1], csrc[2]);
31 fillblock_16byte(vram[0], 0xffffffff, 240 * 160 / 16);
32 fillblock_16byte(vram[1], 0xffffffff, 240 * 160 / 16);
34 tex = iwram_sbrk(32 * 32);
35 memcpy(tex, tuncross_pixels, 32 * 32);
39 backbuf = ++nframes & 1;
44 bot = vram[backbuf] + 159 * 240 / 2;
47 for(j=0; j<240/2; j++) {
48 uint16_t pptop, ppbot;
53 depth = (tun >> 8) & 0xff;
54 tx = ((angle >> 1) + zoffs) & 0x1f;
55 ty = ((depth >> 1) + zoffs) & 0x1f;
56 pptop = tex[(ty << 5) + tx];
57 tx = ((angle >> 1) - zoffs) & 0x1f;
58 ppbot = tex[(ty << 5) + tx];
60 angle = (tun >> 16) & 0xff;
61 depth = (tun >> 24) & 0xff;
62 tx = ((angle >> 1) + zoffs) & 0x1f;
63 ty = ((depth >> 1) + zoffs) & 0x1f;
64 pptop |= (uint16_t)tex[(ty << 5) + tx] << 8;
65 tx = ((angle >> 1) - zoffs) & 0x1f;
66 ppbot |= (uint16_t)tex[(ty << 5) + tx] << 8;