xref: /reactos/subsystems/mvdm/ntvdm/bios/bios32/vbe.h (revision 8a978a17)
1 /*
2  * COPYRIGHT:       GPLv2+ - See COPYING in the top level directory
3  * PROJECT:         ReactOS Virtual DOS Machine
4  * FILE:            subsystems/mvdm/ntvdm/bios/bios32/vbe.h
5  * PURPOSE:         VDM VESA BIOS Extensions (for the Cirrus CL-GD5434 emulated card)
6  * PROGRAMMERS:     Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7  */
8 
9 #ifndef _VBE_H_
10 #define _VBE_H_
11 
12 #include "hardware/video/svga.h"
13 
14 /* DEFINITIONS ****************************************************************/
15 
16 #define OEM_NAME     "Cirrus Logic GD-5434 VGA"
17 #define OEM_NAME_PTR 0xF01D5091
18 
19 #define VBE_MODE_COUNT 40
20 
21 /* VBE Mode Attribute Flags */
22 #define VBE_MODE_SUPPORTED     (1 << 0)
23 #define VBE_MODE_OPTIONAL_INFO (1 << 1)
24 #define VBE_MODE_BIOS_SUPPORT  (1 << 2)
25 #define VBE_MODE_COLOR         (1 << 3)
26 #define VBE_MODE_GRAPHICS      (1 << 4)
27 
28 /* VBE Window Attribute Flags */
29 #define VBE_WINDOW_EXISTS   (1 << 0)
30 #define VBE_WINDOW_READABLE (1 << 1)
31 #define VBE_WINDOW_WRITABLE (1 << 2)
32 
33 /* VBE Memory Models */
34 #define VBE_MODEL_TEXT      0
35 #define VBE_MODEL_CGA       1
36 #define VBE_MODEL_HGC       2
37 #define VBE_MODEL_EGA       3
38 #define VBE_MODEL_PACKED    4
39 #define VBE_MODEL_UNCHAINED 5
40 #define VBE_MODEL_DIRECT    6
41 #define VBE_MODEL_YUV       7
42 
43 #pragma pack(push, 1)
44 
45 typedef struct _VBE_INFORMATION
46 {
47     DWORD Signature;
48     WORD Version;
49     DWORD OemName;
50     DWORD Capabilities;
51     DWORD ModeList;
52     WORD VideoMemory;
53     WORD ModeListBuffer[118];
54 } VBE_INFORMATION, *PVBE_INFORMATION;
55 
56 C_ASSERT(sizeof(VBE_INFORMATION) == 256);
57 
58 typedef struct _VBE_MODE_INFO
59 {
60     WORD Attributes;
61     BYTE WindowAttrA;
62     BYTE WindowAttrB;
63     WORD WindowGranularity;
64     WORD WindowSize;
65     WORD WindowSegmentA;
66     WORD WindowSegmentB;
67     DWORD WindowPosFunc;
68     WORD BytesPerScanline;
69     WORD Width;
70     WORD Height;
71     BYTE CellWidth;
72     BYTE CellHeight;
73     BYTE NumPlanes;
74     BYTE BitsPerPixel;
75     BYTE NumBanks;
76     BYTE MemoryModel;
77     BYTE BankSize;
78     BYTE ImagePages;
79     BYTE Reserved;
80     BYTE RedMaskSize;
81     BYTE RedFieldPosition;
82     BYTE GreenMaskSize;
83     BYTE GreenFieldPosition;
84     BYTE BlueMaskSize;
85     BYTE BlueFieldPosition;
86     BYTE ReservedMaskSize;
87     BYTE ReservedFieldPosition;
88     BYTE DirectColorInfo;
89 } VBE_MODE_INFO, *PVBE_MODE_INFO;
90 
91 C_ASSERT(sizeof(VBE_MODE_INFO) % sizeof(WORD) == 0);
92 
93 typedef const struct _VBE_MODE_INFO *PCVBE_MODE_INFO;
94 
95 #pragma pack(pop)
96 
97 typedef struct _VBE_MODE
98 {
99     BYTE Number;
100     WORD VesaNumber;
101     PCVBE_MODE_INFO Info;
102     PSVGA_REGISTERS Registers;
103 } VBE_MODE, *PVBE_MODE;
104 
105 typedef const struct _VBE_MODE *PCVBE_MODE;
106 
107 /* FUNCTIONS ******************************************************************/
108 
109 VOID WINAPI VbeService(LPWORD Stack);
110 VOID WINAPI VbeResetExtendedRegisters(VOID);
111 BOOLEAN WINAPI VbeSetExtendedVideoMode(BYTE ModeNumber);
112 BOOLEAN VbeInitialize(VOID);
113 
114 #endif // _VBE_H_
115