/* PIXELS.C -- by Gary N Wilkerson Jr.
*
* Demonstrates the usage of the SetVideoMode
* and the SetPixel functions.
*/
#include /* Required for rand() functions */
#include /* Required for int86() functions */
#include /* Required for keyboard functions */
/* Video display definitions */
#define TEXT_MODE 0x03
#define VGA256 0x13
/* Function prototypes */
void SetVideoMode(int mode);
void SetPixel(int X, int Y, unsigned char C);
/* Create a pointer to video memory */
unsigned char far *videoMem = (unsigned char far *)0xA0000000L;
/* Our main program */
int main(void)
{
while (kbhit()) getch(); /* Clear keyboard */
SetVideoMode(VGA256); /* Set VGA mode 13h */
while (!kbhit()) /* Set random dots to random colors */
SetPixel(rand() % 320, rand() % 200, rand() % 256);
SetVideoMode(TEXT_MODE); /* Return to text mode */
while (kbhit()) getch(); /* Clear keyboard */
return 0; /* Return without errors */
}
/* SetVideoMode function */
void SetVideoMode(int mode)
{
union REGS regs; /* Create register variables */
regs.x.ax = mode; /* Set video mode */
/* Call interrupt to complete the task */
int86(0x10, ®s, ®s);
}
/* SetPixel function */
void SetPixel(int X, int Y, unsigned char C)
{
videoMem[Y * 320 + X] = C;
}
               (
geocities.com/siliconvalley/park/7113/GameLib)                   (
geocities.com/siliconvalley/park/7113)                   (
geocities.com/siliconvalley/park)                   (
geocities.com/siliconvalley)