FreeBASIC  0.91.0
vesa.h
Go to the documentation of this file.
1 /* VESA VBE structures and constants */
2 
3 #ifndef __FB_DOS_VESA_H__
4 #define __FB_DOS_VESA_H__
5 
6 /* Info block for the VESA controller */
7 typedef struct VbeInfoBlock
8 {
9  char vbe_signature[4]; /* Must be 'VESA', or 'VBE2' for VESA2 */
10  unsigned short vbe_version; /* 0200h for VESA2 */
11  unsigned int oem_string_ptr; /* Pointer to OEM string */
12  unsigned int capabilities; /* Capabilities of the controller */
13  unsigned int video_mode_ptr; /* Pointer to a video mode list */
14  unsigned short total_memory; /* Number of 64 KB memory blocks (VESA2) */
15  unsigned short oem_software_rev; /* VBE implementation software revision */
16  unsigned int oem_vendor_name; /* Pointer to Vendor Name string */
17  unsigned int oem_product_name; /* Pointer to Product Name string */
18  unsigned int oem_product_rev; /* Pointer to Product Revision string */
19  unsigned char reserved[222]; /* Reserved for VBE implementation scratch area */
20  unsigned char oem_data[256]; /* Data area for OEM strings */
22 
23 
24 /* Mnemonics for VbeInfoBlock.capabilities flags */
25 enum
26 {
27  VIB_8BITDAC = 1 << 0, /* DAC width switchable to 8 bits per primary color */
28  VIB_NOTVGA = 1 << 1, /* Controller is not VGA compatible */
29  VIB_BLANK = 1 << 2 /* RAMDAC recommentds programming during blank */
30 };
31 
32 
33 /* Info block for a VESA video mode */
34 typedef struct VesaModeInfo
35 {
36  /* mandatory for all VBE versions */
37  unsigned short ModeAttributes;
38  unsigned char WinAAttributes;
39  unsigned char WinBAttributes;
40  unsigned short WinGranularity;
41  unsigned short WinSize;
42  unsigned short WinASegment;
43  unsigned short WinBSegment;
44  unsigned long WinFuncPtr;
45  unsigned short BytesPerScanLine;
46 
47  /* mandatory for VBE 1.2 and above */
48  unsigned short XResolution;
49  unsigned short YResolution;
50  unsigned char XCharSize;
51  unsigned char YCharSize;
52  unsigned char NumberOfPlanes;
53  unsigned char BitsPerPixel;
54  unsigned char NumberOfBanks;
55  unsigned char MemoryModel;
56  unsigned char BankSize; /* bank size in KB */
57  unsigned char NumberOfImagePages;
58  unsigned char Reserved_page;
59 
60  /* direct color fields (required for direct and YUV memory models) */
61  unsigned char RedMaskSize;
62  unsigned char RedFieldPosition;
63  unsigned char GreenMaskSize;
64  unsigned char GreenFieldPosition;
65  unsigned char BlueMaskSize;
66  unsigned char BlueFieldPosition;
67  unsigned char RsvdMaskSize;
68  unsigned char RsvdFieldPosition;
69  unsigned char DirectColorModeInfo;
70 
71  /* mandatory for VBE 2.0 and above */
72  unsigned long PhysBasePtr;
73  unsigned long OffScreenMemOffset; /* reserved in VBE 3.0 */
74  unsigned short OffScreenMemSize; /* reserved in VBE 3.0 */
75 
76  /* mandatory for VBE 3.0 and above */
77  unsigned short LinBytesPerScanLine;
78  unsigned char BnkNumberOfImagePages;
79  unsigned char LinNumberOfImagePages;
80  unsigned char LinRedMaskSize;
81  unsigned char LinRedFieldPosition;
82  unsigned char LinGreenMaskSize;
83  unsigned char LinGreenFieldPosition;
84  unsigned char LinBlueMaskSize;
85  unsigned char LinBlueFieldPosition;
86  unsigned char LinRsvdMaskSize;
87  unsigned char LinRsvdFieldPosition;
88  unsigned long MaxPixelClock;
89 
90  unsigned char Reserved[189];
91 }
93 
94 
95 /* Mnemonics for VesaModeInfo.mode_attributes flags */
96 enum
97 {
98  VMI_MA_SUPPORTED = 1 << 0, /* Mode supported by hardware configuration */
99  VMI_MA_TTY = 1 << 2, /* TTY output functions supported by the BIOS */
100  VMI_MA_COLOR = 1 << 3, /* Color mode if set, monochrome if not */
101  VMI_MA_GRAPHICS = 1 << 4, /* Graphics mode if set, text mode if not */
102  VMI_MA_NOTVGA = 1 << 5, /* VGA compatible mode */
103  VMI_MA_NOTVGAWIN = 1 << 6, /* VGA compatible windowed memory available */
104  VMI_MA_LFB = 1 << 7 /* Linear frame buffer mode available */
105 };
106 
107 
108 /* Mnemonics for VesaModeInfo.window_attributes flags */
109 enum
110 {
111  VMI_WA_RELOC = 1 << 0, /* Relocatable window(s) supported */
112  VMI_WA_READ = 1 << 1, /* Window is readable */
113  VMI_WA_WRITE = 1 << 2 /* Window is writeable */
114 };
115 
116 
117 /* Valid values for VesaModeInfo.mem_model */
118 typedef enum VmiMemModel
119 {
120  VMI_MM_TEXT = 0x00, /* Text mode */
121  VMI_MM_CGA = 0x01, /* CGA graphics */
122  VMI_MM_HERC = 0x02, /* Hercules graphics */
123  VMI_MM_PLAN = 0x03, /* Planar */
124  VMI_MM_PACK = 0x04, /* Packed pixel */
125  VMI_MM_NCHN = 0x05, /* Non-chain 4, 256 color */
126  VMI_MM_DIR = 0x06, /* Direct color */
127  VMI_MM_YUV = 0x07, /* YUV color */
128  VMI_MM_OEM = 0x10 /* Start of OEM defined models */
129 }
131 
132 
133 /* Mnemonics for VesaModeInfo.direct_color_mode_info */
134 enum
135 {
136  VMI_DC_RAMP = 1 << 0, /* Color ramp programmable if set, fixed if not */
137  VMI_DC_RSVD = 1 << 1 /* Bits in rsvd field are usable by the application */
138 };
139 
140 typedef struct VesaPMInfo
141 {
142  unsigned short setWindow;
143  unsigned short setDisplayStart;
144  unsigned short setPalette;
145  unsigned short IOPrivInfo;
147 
149 {
150  VBE_INFO = 0x4F00,
151  VBE_MODEINFO = 0x4F01,
152  VBE_SETMODE = 0x4F02,
153  VBE_GETMODE = 0x4F03,
154  VBE_SAVERESTORE = 0x4F04,
155  VBE_WINCTRL = 0x4F05,
159  VBE_SETGETPAL = 0x4F09,
160  VBE_PMODE = 0x4F0A
161 };
162 
164 {
165  VBE_STATUS_OK = 0x004F
166 };
167 
168 enum
169 {
170  VBE_SETGETPAL_SET = 0x00, /* set palette data */
171  VBE_SETGETPAL_GET = 0x01, /* get palette data */
172  VBE_SETGETPAL_SETSEC = 0x02, /* set secondary palette data */
173  VBE_SETGETPAL_GETSEC = 0x03, /* get secondary palette data */
174  VBE_SETGETPAL_SET_BLANK = 0x80 /* wait for vertical blank */
175 };
176 
177 enum
178 {
179  VBE_PMODE_GET = 0x00 /* return protected mode table */
180 };
181 
182 #endif