REG_GP1 = GPCMD(GP1_DISPEN) | (en ? 0 : 1);
}
+void gpu_dispstart(int x, int y)
+{
+ REG_GP1 = GPCMD(GP1_START) | x | (y << 10);
+}
+
void gpu_cliprect(int x, int y, int w, int h)
{
REG_GP0 = GPCMD(GP0_CLIP_TL) | x | (y << 10);
void gpu_reset(void);
void gpu_setmode(int xsz, int ysz, int bpp, int rate);
void gpu_display(int en);
+void gpu_dispstart(int x, int y);
void gpu_cliprect(int x, int y, int w, int h);
void gpu_origin(int x, int y);
int16_t rotmat[9] = {0x1000, 0, 0, 0, 0x1000, 0, 0, 0, 0x1000};
int trans[3] = {160, 120, 0};
int resv[3];
+ int yoffs = 0;
gte_init();
gpu_setmode(320, 264, 15, 50);
gpu_display(1);
- REG_GP0 = GPCMD(GP0_TEXPG) | TEXPG_DRAWDISP | TEXPG_DITHER;
-
- gpu_cliprect(0, 0, 320, 264);
- gpu_origin(0, 0);
+ REG_GP0 = GPCMD(GP0_TEXPG) | TEXPG_DITHER;
for(;;) {
rotmat[0] = rotmat[4] = COS(frame);
gte_cmd_rot();
gte_getvec(resv);
- triangle[i].x = (resv[0] >> 6) + 160;
- triangle[i].y = (resv[1] >> 6) + 130;
+ triangle[i].x = (resv[0] >> 6);
+ triangle[i].y = (resv[1] >> 6);
}
- gpu_fillrect(0, 0, 320, 264, 0x202020);
+ /* use previous frame yoffs as display area */
+ gpu_dispstart(0, yoffs);
+
+ /* set yoffs to the new back buffer */
+ yoffs = (frame++ & 1) ? 0 : 264;
+
+ gpu_cliprect(0, yoffs, 320, 264 + yoffs);
+ gpu_origin(160, 130 + yoffs);
+
+ gpu_fillrect(0, yoffs, 320, 264, 0x202020);
gpu_draw_gouraud(GP0_GTRI, triangle, 3);
- for(i=0; i<100000; i++) {
+ for(i=0; i<8192; i++) {
asm volatile("nop; nop; nop; nop");
}
-
- frame++;
}
return 0;
}