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)
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 FONT_8x8_COMPAT_OFFSET 0xFA6E
36 #define VIDEO_STATE_INFO_OFFSET 0x3000 // == 0x1900 + (sizeof(Font8x14) == 0x0E00) + 0x0900 for padding
38 #define VIDEO_BIOS_ROM_SIZE 0x4000
50 typedef struct _VGA_STATIC_FUNC_TABLE
52 BYTE SupportedModes
[3]; // 0x00
53 DWORD Reserved0
; // 0x03
54 BYTE SupportedScanlines
; // 0x07
55 BYTE TextCharBlocksNumber
; // 0x08
56 BYTE MaxActiveTextCharBlocksNumber
; // 0x09
57 WORD VGAFuncSupportFlags
; // 0x0a
58 WORD Reserved1
; // 0x0c
59 BYTE VGASavePtrFuncFlags
; // 0x0e
60 BYTE Reserved2
; // 0x0f
61 } VGA_STATIC_FUNC_TABLE
, *PVGA_STATIC_FUNC_TABLE
;
63 typedef struct _VGA_DYNAMIC_FUNC_TABLE
65 DWORD StaticFuncTablePtr
; // 0x00
68 * The following fields follow the same order as in the BDA,
69 * from offset 0x49 up to offset 0x66...
71 BYTE VideoMode
; // 0x04
72 WORD ScreenColumns
; // 0x05
73 WORD VideoPageSize
; // 0x07
74 WORD VideoPageOffset
; // 0x09
75 WORD CursorPosition
[BIOS_MAX_PAGES
]; // 0x0b
76 BYTE CursorEndLine
; // 0x1b
77 BYTE CursorStartLine
; // 0x1c
78 BYTE VideoPage
; // 0x1d
79 WORD CrtBasePort
; // 0x1e
80 BYTE CrtModeControl
; // 0x20
81 BYTE CrtColorPaletteMask
; // 0x21
82 /* ... and offsets 0x84 and 0x85. */
83 BYTE ScreenRows
; // 0x22
84 WORD CharacterHeight
; // 0x23
86 BYTE VGADccIDActive
; // 0x25
87 BYTE VGADccIDAlternate
; // 0x26
88 WORD CurrModeSupportedColorsNum
; // 0x27
89 BYTE CurrModeSupportedPagesNum
; // 0x29
90 BYTE Scanlines
; // 0x2a
91 BYTE PrimaryCharTable
; // 0x2b
92 BYTE SecondaryCharTable
; // 0x2c
94 /* Contains part of information from BDA::VGAFlags (offset 0x89) */
95 BYTE VGAFlags
; // 0x2d
97 BYTE Reserved0
[3]; // 0x2e
98 BYTE VGAAvailMemory
; // 0x31
99 BYTE VGASavePtrStateFlags
; // 0x32
100 BYTE VGADispInfo
; // 0x33
102 BYTE Reserved1
[12]; // 0x34 - 0x40
103 } VGA_DYNAMIC_FUNC_TABLE
, *PVGA_DYNAMIC_FUNC_TABLE
;
107 /* MACROS *********************************************************************/
110 // These macros are defined for ease-of-use of some VGA I/O ports
111 // whose addresses depend whether we are in Monochrome or Colour mode.
113 #define VGA_INSTAT1_READ Bda->CrtBasePort + 6 // VGA_INSTAT1_READ_MONO or VGA_INSTAT1_READ_COLOR
114 #define VGA_CRTC_INDEX Bda->CrtBasePort // VGA_CRTC_INDEX_MONO or VGA_CRTC_INDEX_COLOR
115 #define VGA_CRTC_DATA Bda->CrtBasePort + 1 // VGA_CRTC_DATA_MONO or VGA_CRTC_DATA_COLOR
117 /* FUNCTIONS ******************************************************************/
119 VOID WINAPI
VidBiosVideoService(LPWORD Stack
);
121 VOID
VidBiosDetachFromConsole(VOID
);
122 VOID
VidBiosAttachToConsole(VOID
);
124 VOID
VidBiosPost(VOID
);
125 BOOLEAN
VidBiosInitialize(VOID
);
126 VOID
VidBiosCleanup(VOID
);
128 #endif /* _VIDBIOS_H_ */