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