home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume34 / vesa_lib / part01 / vesa.h < prev   
Encoding:
C/C++ Source or Header  |  1993-01-10  |  2.6 KB  |  120 lines

  1. /*
  2.  
  3. Written by: Robert C. Pendleton
  4.  
  5. Placed in the public domain by the author.
  6.  
  7. */
  8.  
  9. #ifndef _VESA_H_
  10. #define _VESA_H_
  11.  
  12. /*
  13.  
  14. VESA graphics driver for 256 color VESA graphic modes. It requires
  15. a VESA version 1.1 BIOS.
  16.  
  17. It has been tested with a VESA 1.1 BIOS on an ET4000
  18.  
  19. */
  20.  
  21. #include "ptypes.h"
  22.  
  23. //---------------------------------------------------
  24. /*
  25. */
  26.  
  27. typedef struct {
  28.     uint8 red;
  29.     uint8 green;
  30.     uint8 blue;
  31. } palette;
  32.  
  33.  
  34. //---------------------------------------------------
  35. /*
  36. */
  37.  
  38. typedef enum {
  39.     NONE       = 0x000,
  40.     g320x200   = 0x013,
  41.     g640x400   = 0x100,
  42.     g640x480   = 0x101,
  43.     g800x600   = 0x103,
  44.     g1024x768  = 0x105,
  45.     g1280x1024 = 0x107,
  46. } vesaMode;
  47.  
  48. //---------------------------------------------------
  49. /*
  50. */
  51.  
  52. typedef union {
  53.     struct {
  54.         uint8 vesa[4];
  55.         uint8 majorMode;
  56.         uint8 minorMode;
  57.         uint8 _far *vendorName;
  58.         uint32 capabilities;
  59.         int16 _far *modes;
  60.     };
  61.     uint8 filler[512];
  62. } vesaInfo;
  63.  
  64. //---------------------------------------------------
  65. /*
  66. */
  67.  
  68. typedef union {
  69.         struct {
  70.         uint16 modeAttr;
  71.         uint8 windowAAttr;
  72.         uint8 windowBAttr;
  73.         uint16 windowGranularity;
  74.         uint16 windowSize;
  75.         uint16 windowAStartSeg;
  76.         uint16 windowBStartSeg;
  77.         uint32 posFuncPtr;
  78.         uint16 bytesPerScanLine;
  79. /*------------ Optional ------------*/
  80.         uint16 width;
  81.         uint16 height;
  82.         uint8 charWidth;
  83.         uint8 charHeight;
  84.         uint8 numberOfPlanes;
  85.         uint8 bitsPerPixel;
  86.         uint8 numberOfBanks;
  87.         uint8 memoryModel;
  88.         uint8 sizeOfBank;
  89.     };
  90.     uint8 filler[512];
  91. } vesaModeInfo;
  92.  
  93. //---------------------------------------------------
  94. /*
  95. */
  96.  
  97. extern void setVGAColor(int16 index, int16 r, int16 g, int16 b);
  98. extern void setVGAPalette(palette *p);
  99. extern boolean getVesaInfo(vesaInfo *infoPtr);
  100. extern void printVesaInfo(FILE *file, vesaInfo *info);
  101. extern boolean getVesaModeInfo(int16 mode, vesaModeInfo *infoPtr);
  102. extern void printVesaModeInfo(FILE *file, vesaModeInfo *info);
  103. extern boolean setVesaMode(int16 mode);
  104. extern boolean getVesaMode(int16 *mode);
  105. extern boolean getVesaStateSize(uint8 flags, int32 *size);
  106. extern boolean getVesaState(uint8 flags, uint8 *buffer);
  107. extern boolean setVesaState(uint8 flags, uint8 *buffer);
  108. extern boolean setVesaWinAAddr(uint16 addr);
  109. extern boolean setVesaWinBAddr(uint16 addr);
  110. extern boolean getVesaWinAAddr(uint16 *addr);
  111. extern boolean getVesaWinBAddr(uint16 *addr);
  112. extern boolean setVesaScanLineLength(uint16 length);
  113. extern boolean getVesaScanLineLength(uint16 *bytesPerScanLine, 
  114.                      uint16 *pixelsPerScanLine, 
  115.                      uint16 *maxScanLines);
  116. extern boolean setVesaDisplayStart(uint16 pixel, uint16 line);
  117. extern boolean getVesaDisplayStart(uint16 *pixel, uint16 *line);
  118.  
  119. #endif
  120.