11 void handle_key(int key);
12 void interrupt timer_intr();
15 static unsigned char *fb;
17 static volatile unsigned long nticks;
19 static void interrupt (*prev_timer_intr)();
23 long rate, nframes = 0;
26 if(!(fb = malloc(64000))) {
27 fprintf(stderr, "failed to allocate framebuffer\n");
34 g3d_framebuffer(320, 200, fb);
36 prev_timer_intr = _dos_getvect(0x1c);
37 _dos_setvect(0x1c, timer_intr);
55 tdur = nticks - tstart;
57 _dos_setvect(0x1c, prev_timer_intr);
62 rate = nframes * 100 * 18 / tdur;
63 printf("%ld frames in %ld sec, rate: %ld.%ld\n", nframes, tdur / 18,
64 rate / 100, rate % 100);
68 struct g3d_vertex varr[] = {
69 {0, 0x8000, 0, 0x10000},
70 {-0x8f00, -0x8000, 0, 0x10000},
71 {0x8c00, -0x6000, 0, 0x10000}
74 void mat_rotz(int32_t *m, int theta)
82 m[2] = m[3] = m[6] = m[7] = m[8] = m[9] = m[11] = m[12] = m[13] = m[14] = 0;
91 mat_rotz(xform, nticks);
95 g3d_draw(G3D_TRIANGLES, varr, sizeof varr / sizeof *varr);
101 void handle_key(int key)
110 void interrupt timer_intr()
113 _chain_intr(prev_timer_intr);