[mvdm] Fix missing pointer dereference
[reactos.git] / subsystems / mvdm / ntvdm / bios / bios.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: subsystems/mvdm/ntvdm/bios/bios.h
5 * PURPOSE: VDM BIOS Support Library
6 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
7 */
8
9 #ifndef _BIOS_H_
10 #define _BIOS_H_
11
12 /* INCLUDES *******************************************************************/
13
14 #include "kbdbios.h"
15 #include "vidbios.h"
16
17 /* DEFINES ********************************************************************/
18
19 /* BOP Identifiers */
20 #define BOP_RESET 0x00 // Windows NTVDM (SoftPC) BIOS calls BOP 0x00
21 // to let the virtual machine perform the POST.
22 #define BOP_EQUIPLIST 0x11
23 #define BOP_GETMEMSIZE 0x12
24
25
26
27
28 #define BDA_SEGMENT 0x40
29 #define BIOS_SEGMENT 0xF000
30
31 #pragma pack(push, 1)
32
33 /*
34 * BIOS Data Area at 0040:XXXX
35 *
36 * See: http://webpages.charter.net/danrollins/techhelp/0093.HTM
37 * and: http://www.bioscentral.com/misc/bda.htm
38 * for more information.
39 */
40 typedef struct
41 {
42 WORD SerialPorts[4]; // 0x00
43 WORD ParallelPorts[3]; // 0x08
44 WORD EbdaSegment; // 0x0e - ParallelPort in PC/XT
45 WORD EquipmentList; // 0x10
46 BYTE Reserved0; // 0x12 - Errors in PCjr infrared keyboard link
47 WORD MemorySize; // 0x13
48 WORD Reserved1; // 0x15 - Scratch pad for manufacturing error tests
49 WORD KeybdShiftFlags; // 0x17
50 BYTE AlternateKeypad; // 0x19
51 WORD KeybdBufferHead; // 0x1a
52 WORD KeybdBufferTail; // 0x1c
53 WORD KeybdBuffer[BIOS_KBD_BUFFER_SIZE]; // 0x1e
54 BYTE DriveRecalibrate; // 0x3e
55 BYTE DriveMotorStatus; // 0x3f
56 BYTE MotorShutdownCounter; // 0x40
57 BYTE LastDisketteOperation; // 0x41
58 BYTE Reserved2[7]; // 0x42
59 BYTE VideoMode; // 0x49
60 WORD ScreenColumns; // 0x4a
61 WORD VideoPageSize; // 0x4c
62 WORD VideoPageOffset; // 0x4e
63 WORD CursorPosition[BIOS_MAX_PAGES]; // 0x50
64 BYTE CursorEndLine; // 0x60
65 BYTE CursorStartLine; // 0x61
66 BYTE VideoPage; // 0x62
67 WORD CrtBasePort; // 0x63
68 BYTE CrtModeControl; // 0x65
69 BYTE CrtColorPaletteMask; // 0x66
70
71 union // 0x67
72 {
73 BYTE CassetteData[5]; // Cassette tape control (unused)
74 DWORD ResumeEntryPoint; // CS:IP for 286 return from Protected Mode
75 };
76
77 DWORD TickCounter; // 0x6c
78 BYTE MidnightPassed; // 0x70
79 BYTE CtrlBreakFlag; // 0x71
80 WORD SoftReset; // 0x72
81 BYTE LastDiskOperation; // 0x74
82 BYTE NumDisks; // 0x75
83 BYTE DriveControlByte; // 0x76
84 BYTE DiskPortOffset; // 0x77
85 BYTE LptTimeOut[4]; // 0x78
86 BYTE ComTimeOut[4]; // 0x7c
87 WORD KeybdBufferStart; // 0x80
88 WORD KeybdBufferEnd; // 0x82
89 BYTE ScreenRows; // 0x84
90 WORD CharacterHeight; // 0x85
91 BYTE VGAOptions; // 0x87
92 BYTE VGASwitches; // 0x88
93 BYTE VGAFlags; // 0x89
94 BYTE VGADccIDActive; // 0x8a
95 DWORD Reserved3; // 0x8b
96 BYTE Reserved4; // 0x8f
97 BYTE FloppyDriveState[2]; // 0x90
98 BYTE Reserved6[2]; // 0x92
99 BYTE Reserved7[2]; // 0x94
100 BYTE KeybdStatusFlags; // 0x96
101 BYTE KeybdLedFlags; // 0x97
102 DWORD Reserved9; // 0x98
103 DWORD Reserved10; // 0x9c
104 DWORD Reserved11[2]; // 0xa0
105 DWORD EGAPtr; // 0xa8
106 BYTE Reserved12[68]; // 0xac
107 BYTE Reserved13[16]; // 0xf0
108 } BIOS_DATA_AREA, *PBIOS_DATA_AREA;
109 C_ASSERT(sizeof(BIOS_DATA_AREA) == 0x100);
110
111 /*
112 * User Data Area at 0050:XXXX
113 *
114 * See: http://helppc.netcore2k.net/table/memory-map
115 * for more information.
116 */
117 typedef struct
118 {
119 BYTE PrintScreen; // 0x00
120 BYTE Basic0[3]; // 0x01
121 BYTE SingleDisketteFlag; // 0x04
122 BYTE PostArea[10]; // 0x05
123 BYTE Basic1; // 0x0f
124 WORD Basic2; // 0x10
125 DWORD Basic3; // 0x12
126 DWORD Basic4; // 0x16
127 DWORD Basic5; // 0x1a
128 WORD Reserved0; // 0x1e
129 WORD DynStorage; // 0x20
130 BYTE DisketteInitStorage[14]; // 0x22
131 DWORD Reserved1; // 0x30
132 } USER_DATA_AREA, *PUSER_DATA_AREA;
133 C_ASSERT(sizeof(USER_DATA_AREA) == 0x34);
134
135 /*
136 * BIOS Configuration Table at F000:E6F5 for 100% compatible BIOSes.
137 *
138 * See: http://www.ctyme.com/intr/rb-1594.htm
139 * for more information.
140 */
141 typedef struct _BIOS_CONFIG_TABLE
142 {
143 WORD Length; // 0x00 - Number of bytes following
144 BYTE Model; // 0x02
145 BYTE SubModel; // 0x03
146 BYTE Revision; // 0x04
147 BYTE Feature[5]; // 0x05 -- 0x09
148 // Other BIOSes may extend this table. We don't.
149 } BIOS_CONFIG_TABLE, *PBIOS_CONFIG_TABLE;
150
151 #pragma pack(pop)
152
153 /* FUNCTIONS ******************************************************************/
154
155 extern PBIOS_DATA_AREA Bda;
156 extern PBIOS_CONFIG_TABLE Bct;
157
158 VOID WINAPI BiosEquipmentService(LPWORD Stack);
159 VOID WINAPI BiosGetMemorySize(LPWORD Stack);
160
161 BOOLEAN
162 BiosInitialize(IN LPCSTR BiosFileName,
163 IN LPCSTR RomFiles OPTIONAL);
164
165 VOID
166 BiosCleanup(VOID);
167
168 #endif // _BIOS_H_
169
170 /* EOF */