/* VGA256.H The header file use to declare the functions that render dots, circles, lines and text in VGA Mode 13H. The video mode capable of displaying 320x200 pixels in 256 colors. This was written by Gary Wilkerson Jr for use by the entire gaming community. This code is not copyrighted nor do I expect any of it to be copyrighted. This code is to be 'common knowledge' among the gaming community. You are free to use and modify it in any way as you see fit. Happy programming. */ #ifndef __VGA256_H #define __VGA256_H #include #include #include #include #ifdef __cplusplus extern "C" { #endif #define VGA256 0x13 #define TEXT_MODE 0x03 #define PALETTE_MASK 0x3C6 #define PALETTE_READ_REGISTER 0x3C7 #define PALETTE_WRITE_REGISTER 0x3C8 #define PALETTE_DATA 0x3C9 #define VGA_STATUS_1 0x3DA #define VGA_RETRACE_MASK 0x08 extern unsigned char far *videoMem; extern unsigned char far *cacheMem; extern unsigned int cacheSize; extern unsigned int cacheLines; extern unsigned char far *charSet; #define CharWidth 8 #define CharHeight 8 #define ScreenWidth (unsigned int)320 #define ScreenHeight (unsigned int)200 struct RGB_Color { unsigned char red; unsigned char green; unsigned char blue; }; void SetVideoMode(int mode); #define FillScreen(c) _fmemset(videoMem, (c), ScreenWidth * ScreenHeight) #define SetPixel(x,y,c) videoMem[(y<<8) + (y<<6) + x] = c void Circle(int x, int y, int radius, unsigned char color); void Line(int x1, int y1, int x2, int y2, unsigned char color); #define FillScreenC(c) if (cacheMem) _fmemset(cacheMem, (c), cacheSize) #define SetPixelC(x,y,c) if (cacheMem) cacheMem[(y<<8) + (y<<6) + x] = c void CircleC(int x, int y, int radius, unsigned char color); void LineC(int x1, int y1, int x2, int y2, unsigned char color); void SetPaletteRegister(int index, struct RGB_Color *color); void GetPaletteRegister(int index, struct RGB_Color *color); void Gputch(int x, int y, int c, int fc, int bc); void Gputs(int x, int y, char *string, int fc, int bc); int InitCache(unsigned int numLines); void DeleteCache(void); #define ShowCache() if (cacheMem) _fmemcpy(videoMem, cacheMem, cacheSize) void WaitForVertRetrace(void); #ifdef __cplusplus } #endif #endif /* __VGA256_H */