2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
5 * PURPOSE: VDM Video BIOS Support Library
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
13 /* DEFINES ********************************************************************/
15 #define BIOS_VIDEO_INTERRUPT 0x10
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
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
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
34 #define VIDEO_STATE_INFO_OFFSET 0x3000 // == 0x1900 + (sizeof(Font8x14) == 0x0E00) + 0x0900 for padding
36 #define VIDEO_BIOS_ROM_SIZE 0x4000
48 typedef struct _VGA_STATIC_FUNC_TABLE
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
;
61 typedef struct _VGA_DYNAMIC_FUNC_TABLE
63 DWORD StaticFuncTablePtr
; // 0x00
66 * The following fields follow the same order as in the BDA,
67 * from offset 0x49 up to offset 0x66...
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
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
92 /* Contains part of information from BDA::VGAFlags (offset 0x89) */
93 BYTE VGAFlags
; // 0x2d
95 BYTE Reserved0
[3]; // 0x2e
96 BYTE VGAAvailMemory
; // 0x31
97 BYTE VGASavePtrStateFlags
; // 0x32
98 BYTE VGADispInfo
; // 0x33
100 BYTE Reserved1
[12]; // 0x34 - 0x40
101 } VGA_DYNAMIC_FUNC_TABLE
, *PVGA_DYNAMIC_FUNC_TABLE
;
105 /* FUNCTIONS ******************************************************************/
107 VOID
VidBiosSyncCursorPosition(VOID
);
109 VOID WINAPI
VidBiosVideoService(LPWORD Stack
);
111 VOID
VidBiosDetachFromConsole(VOID
);
112 VOID
VidBiosAttachToConsole(VOID
);
114 VOID
VidBiosPost(VOID
);
115 BOOLEAN
VidBiosInitialize(VOID
);
116 VOID
VidBiosCleanup(VOID
);
118 #endif // _VIDBIOS_H_