home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Programming Black Book (Special Edition)
/
BlackBook.bin
/
disk1
/
source
/
chapter42
/
l42-3.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-06-18
|
764b
|
31 lines
/* VGA mode 13h pixel-drawing and mode set functions.
* Tested with Borland C++ 4.02 in small model by Jim Mischel 12/16/94.
*/
#include <dos.h>
/* Screen dimension globals, used in main program to scale. */
int ScreenWidthInPixels = 320;
int ScreenHeightInPixels = 200;
/* Mode 13h draw pixel function. */
void DrawPixel(int X, int Y, int Color)
{
#define SCREEN_SEGMENT 0xA000
unsigned char far *ScreenPtr;
FP_SEG(ScreenPtr) = SCREEN_SEGMENT;
FP_OFF(ScreenPtr) = (unsigned int) Y * ScreenWidthInPixels + X;
*ScreenPtr = Color;
}
/* Mode 13h mode-set function. */
void SetMode()
{
union REGS regset;
/* Set to 320x200 256-color graphics mode */
regset.x.ax = 0x0013;
int86(0x10, ®set, ®set);
}