#include "gpu.h"
+#include "gte.h"
#include "psxregs.h"
+#include "sintab.h"
-static struct gpu_gvert triangle[] = {
- {0xff0000, 160, 16}, {0x00ff00, 32, 180}, {0x0000ff, 280, 220}
+static struct gpu_gvert triangle[] = {{0xff0000}, {0x00ff00}, {0x0000ff}};
+
+static struct gte_svector svtri[] = {
+ {-0x1000, -0x800}, {0, 0x1000}, {0x1000, -0x800}
};
int dbg;
int main(void)
{
+ int i;
+ unsigned int frame = 0;
+ int16_t rotmat[9] = {0x1000, 0, 0, 0, 0x1000, 0, 0, 0, 0x1000};
+ int trans[3] = {160, 120, 0};
+ int resv[3];
+
+ gte_init();
+
gpu_reset();
gpu_setmode(320, 264, 15, 50);
gpu_display(1);
gpu_cliprect(0, 0, 320, 264);
gpu_origin(0, 0);
- gpu_fillrect(0, 0, 320, 264, 0x003f00);
+ for(;;) {
+ rotmat[0] = rotmat[4] = COS(frame);
+ rotmat[1] = SIN(frame);
+ rotmat[3] = -SIN(frame);
+
+ gte_loadrot(rotmat);
+ //gte_loadtrans(trans);
+ for(i=0; i<3; i++) {
+ gte_loadsvec0(svtri + i);
+ gte_cmd_rot();
+ gte_getvec(resv);
+
+ triangle[i].x = (resv[0] >> 6) + 160;
+ triangle[i].y = (resv[1] >> 6) + 130;
+ }
+
+ gpu_fillrect(0, 0, 320, 264, 0x202020);
+
+ gpu_draw_gouraud(GP0_GTRI, triangle, 3);
- gpu_draw_gouraud(GP0_GTRI, triangle, 3);
+ for(i=0; i<100000; i++) {
+ asm volatile("nop; nop; nop; nop");
+ }
- for(;;);
+ frame++;
+ }
return 0;
}