#include #include int vga_init (void); int vga_setmode (int mode); int vga_drawline (int x1, int y1, int x2, int y2); int vga_setcolor (int color); int vga_clear (void); int vga_getdefaultmode (void); int vga_getch (void); int main () { int z = 1; int x1 = 0; int y1 = 0; int x2 = 0; int y2 = 0; int clr; int mode = vga_getdefaultmode (); if (mode < 1 || mode > 12) { printf ("Setting your mode to 1\n"); mode = 1; } else printf ("Your default mode is %d\n\n", mode); printf ("Welcome to shapes\n"); printf ("Colors to count: "); scanf ("%d", &clr); vga_init (); vga_setmode (mode); vga_setcolor (z); for (;;) { x1 = x1 + 10; y1 = y1 + 1; x2 = x2 + 1; y2 = y2 + 10; if (x1 > 800) { x1 = 10; vga_clear (); } if (y1 > 600) y1 = 1; if (x2 > 800) x2 = 1; if (y2 > 600) y2 = 10; z++; if (z > clr || z == 257) z = 1; vga_setcolor (z); vga_drawline (x1, y1, x2, y2); vga_drawline (y2, x2, y1, x1); } }