12 int i, j, tx, ty, angle, depth, nframes, backbuf, zoffs;
13 static uint16_t *vram[] = { (uint16_t*)VRAM_LFB_FB0_ADDR, (uint16_t*)VRAM_LFB_FB1_ADDR };
14 uint16_t *cdst, *top, *bot;
16 uint32_t tun, *tunptr;
19 REG_DISPCNT = 4 | DISPCNT_BG2 | DISPCNT_FB1;
21 vblperf_setcolor(0xff);
23 cdst = (uint16_t*)CRAM_BG_ADDR;
25 for(i=0; i<256; i++) {
26 *cdst++ = CONV_RGB24_RGB15(csrc[0], csrc[1], csrc[2]);
30 fillblock_16byte(vram[0], 0xffffffff, 240 * 160 / 16);
31 fillblock_16byte(vram[1], 0xffffffff, 240 * 160 / 16);
33 tex = iwram_sbrk(32 * 32);
34 memcpy(tex, tuncross_pixels, 32 * 32);
38 backbuf = ++nframes & 1;
43 bot = vram[backbuf] + 159 * 240 / 2;
49 for(j=1; j<240/2; j++) {
50 uint16_t pptop, ppbot;
55 depth = (tun >> 8) & 0xff;
56 tx = ((angle >> 1) + zoffs) & 0x1f;
57 ty = ((depth >> 1) + zoffs) & 0x1f;
58 pptop = tex[(ty << 5) + tx];
59 tx = ((angle >> 1) - zoffs) & 0x1f;
60 ppbot = tex[(ty << 5) + tx];
62 angle = (tun >> 16) & 0xff;
63 depth = (tun >> 24) & 0xff;
64 tx = ((angle >> 1) + zoffs) & 0x1f;
65 ty = ((depth >> 1) + zoffs) & 0x1f;
66 pptop |= (uint16_t)tex[(ty << 5) + tx] << 8;
67 tx = ((angle >> 1) - zoffs) & 0x1f;
68 ppbot |= (uint16_t)tex[(ty << 5) + tx] << 8;