[BASESRV][NTVDM][TESTVDD] Improve the FILE header section. Brought to you by Adam...
[reactos.git] / reactos / subsystems / mvdm / ntvdm / bios / vidbios.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: subsystems/mvdm/ntvdm/bios/vidbios.h
5 * PURPOSE: VDM 32-bit Video BIOS Support Library
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 */
9
10 #ifndef _VIDBIOS_H_
11 #define _VIDBIOS_H_
12
13 /* DEFINES ********************************************************************/
14
15 #define BIOS_VIDEO_INTERRUPT 0x10
16
17 #define CONSOLE_FONT_HEIGHT 8
18 #define BIOS_DEFAULT_VIDEO_MODE 0x03
19 #define BIOS_MAX_PAGES 8
20 #define BIOS_MAX_VIDEO_MODE 0x13
21 #define DEFAULT_ATTRIBUTE 0x07
22
23 #define GRAPHICS_VIDEO_SEG 0xA000
24 #define TEXT_VIDEO_SEG 0xB800
25 #define CGA_EVEN_VIDEO_SEG 0xB800
26 #define CGA_ODD_VIDEO_SEG 0xBA00
27 #define VIDEO_BIOS_DATA_SEG 0xC000
28
29 #define FONT_8x8_OFFSET 0x0100
30 #define FONT_8x8_HIGH_OFFSET 0x0500
31 #define FONT_8x16_OFFSET 0x0900
32 #define FONT_8x14_OFFSET 0x1900
33
34 #define VIDEO_STATE_INFO_OFFSET 0x3000 // == 0x1900 + (sizeof(Font8x14) == 0x0E00) + 0x0900 for padding
35
36 #define VIDEO_BIOS_ROM_SIZE 0x4000
37
38 typedef enum
39 {
40 SCROLL_UP,
41 SCROLL_DOWN,
42 SCROLL_LEFT,
43 SCROLL_RIGHT
44 } SCROLL_DIRECTION;
45
46 #pragma pack(push, 1)
47
48 typedef struct _VGA_STATIC_FUNC_TABLE
49 {
50 BYTE SupportedModes[3]; // 0x00
51 DWORD Reserved0; // 0x03
52 BYTE SupportedScanlines; // 0x07
53 BYTE TextCharBlocksNumber; // 0x08
54 BYTE MaxActiveTextCharBlocksNumber; // 0x09
55 WORD VGAFuncSupportFlags; // 0x0a
56 WORD Reserved1; // 0x0c
57 BYTE VGASavePtrFuncFlags; // 0x0e
58 BYTE Reserved2; // 0x0f
59 } VGA_STATIC_FUNC_TABLE, *PVGA_STATIC_FUNC_TABLE;
60
61 typedef struct _VGA_DYNAMIC_FUNC_TABLE
62 {
63 DWORD StaticFuncTablePtr; // 0x00
64
65 /*
66 * The following fields follow the same order as in the BDA,
67 * from offset 0x49 up to offset 0x66...
68 */
69 BYTE VideoMode; // 0x04
70 WORD ScreenColumns; // 0x05
71 WORD VideoPageSize; // 0x07
72 WORD VideoPageOffset; // 0x09
73 WORD CursorPosition[BIOS_MAX_PAGES]; // 0x0b
74 BYTE CursorEndLine; // 0x1b
75 BYTE CursorStartLine; // 0x1c
76 BYTE VideoPage; // 0x1d
77 WORD CrtBasePort; // 0x1e
78 BYTE CrtModeControl; // 0x20
79 BYTE CrtColorPaletteMask; // 0x21
80 /* ... and offsets 0x84 and 0x85. */
81 BYTE ScreenRows; // 0x22
82 WORD CharacterHeight; // 0x23
83
84 BYTE VGADccIDActive; // 0x25
85 BYTE VGADccIDAlternate; // 0x26
86 WORD CurrModeSupportedColorsNum; // 0x27
87 BYTE CurrModeSupportedPagesNum; // 0x29
88 BYTE Scanlines; // 0x2a
89 BYTE PrimaryCharTable; // 0x2b
90 BYTE SecondaryCharTable; // 0x2c
91
92 /* Contains part of information from BDA::VGAFlags (offset 0x89) */
93 BYTE VGAFlags; // 0x2d
94
95 BYTE Reserved0[3]; // 0x2e
96 BYTE VGAAvailMemory; // 0x31
97 BYTE VGASavePtrStateFlags; // 0x32
98 BYTE VGADispInfo; // 0x33
99
100 BYTE Reserved1[12]; // 0x34 - 0x40
101 } VGA_DYNAMIC_FUNC_TABLE, *PVGA_DYNAMIC_FUNC_TABLE;
102
103 #pragma pack(pop)
104
105 /* FUNCTIONS ******************************************************************/
106
107 VOID WINAPI VidBiosVideoService(LPWORD Stack);
108
109 VOID VidBiosDetachFromConsole(VOID);
110 VOID VidBiosAttachToConsole(VOID);
111
112 VOID VidBiosPost(VOID);
113 BOOLEAN VidBiosInitialize(VOID);
114 VOID VidBiosCleanup(VOID);
115
116 #endif // _VIDBIOS_H_
117
118 /* EOF */