[NTVDM]: Implement PC reset handling in the BIOS. Used by some apps for switching...
[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: 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 initialize itself
22 // the IVT and its hardware.
23 #define BOP_EQUIPLIST 0x11
24 #define BOP_GETMEMSIZE 0x12
25
26
27
28
29 #define BDA_SEGMENT 0x40
30 #define BIOS_SEGMENT 0xF000
31
32 // HACK: Disable FPU for now because it is not fully ready yet for being used
33 // by all applications (e.g. QBasic runtime would use the native FPU if the bit
34 // is set, but then subsequently fails, unless the FPU bit is unset in that case
35 // QBasic uses its emulated FPU).
36 #define BIOS_EQUIPMENT_LIST 0x2C // Bit1: FPU, Bit 2: Mouse
37
38 #pragma pack(push, 1)
39
40 /*
41 * BIOS Data Area at 0040:XXXX
42 *
43 * See: http://webpages.charter.net/danrollins/techhelp/0093.HTM
44 * and: http://www.bioscentral.com/misc/bda.htm
45 * for more information.
46 */
47 typedef struct
48 {
49 WORD SerialPorts[4]; // 0x00
50 WORD ParallelPorts[3]; // 0x08
51 WORD EbdaSegment; // 0x0e - ParallelPort in PC/XT
52 WORD EquipmentList; // 0x10
53 BYTE Reserved0; // 0x12 - Errors in PCjr infrared keyboard link
54 WORD MemorySize; // 0x13
55 WORD Reserved1; // 0x15 - Scratch pad for manufacturing error tests
56 WORD KeybdShiftFlags; // 0x17
57 BYTE AlternateKeypad; // 0x19
58 WORD KeybdBufferHead; // 0x1a
59 WORD KeybdBufferTail; // 0x1c
60 WORD KeybdBuffer[BIOS_KBD_BUFFER_SIZE]; // 0x1e
61 BYTE DriveRecalibrate; // 0x3e
62 BYTE DriveMotorStatus; // 0x3f
63 BYTE MotorShutdownCounter; // 0x40
64 BYTE LastDisketteOperation; // 0x41
65 BYTE Reserved2[7]; // 0x42
66 BYTE VideoMode; // 0x49
67 WORD ScreenColumns; // 0x4a
68 WORD VideoPageSize; // 0x4c
69 WORD VideoPageOffset; // 0x4e
70 WORD CursorPosition[BIOS_MAX_PAGES]; // 0x50
71 BYTE CursorEndLine; // 0x60
72 BYTE CursorStartLine; // 0x61
73 BYTE VideoPage; // 0x62
74 WORD CrtBasePort; // 0x63
75 BYTE CrtModeControl; // 0x65
76 BYTE CrtColorPaletteMask; // 0x66
77
78 union // 0x67
79 {
80 BYTE CassetteData[5]; // Cassette tape control (unused)
81 DWORD ResumeEntryPoint; // CS:IP for 286 return from Protected Mode
82 };
83
84 DWORD TickCounter; // 0x6c
85 BYTE MidnightPassed; // 0x70
86 BYTE BreakFlag; // 0x71
87 WORD SoftReset; // 0x72
88 BYTE LastDiskOperation; // 0x74
89 BYTE NumDisks; // 0x75
90 BYTE DriveControlByte; // 0x76
91 BYTE DiskPortOffset; // 0x77
92 BYTE LptTimeOut[4]; // 0x78
93 BYTE ComTimeOut[4]; // 0x7c
94 WORD KeybdBufferStart; // 0x80
95 WORD KeybdBufferEnd; // 0x82
96 BYTE ScreenRows; // 0x84
97 WORD CharacterHeight; // 0x85
98 BYTE VGAOptions; // 0x87
99 BYTE VGASwitches; // 0x88
100 BYTE VGAFlags[2]; // 0x89
101 DWORD Reserved3; // 0x8b
102 BYTE Reserved4; // 0x8f
103 BYTE Reserved5[2]; // 0x90
104 BYTE Reserved6[2]; // 0x92
105 BYTE Reserved7[2]; // 0x94
106 WORD KeybdStatusFlags; // 0x96
107 DWORD Reserved9; // 0x98
108 DWORD Reserved10; // 0x9c
109 DWORD Reserved11[2]; // 0xa0
110 DWORD EGAPtr; // 0xa8
111 BYTE Reserved12[68]; // 0xac
112 BYTE Reserved13[16]; // 0xf0
113
114 DWORD Reserved14; // 0x100
115 BYTE Reserved15[12]; // 0x104
116 BYTE Reserved16[17]; // 0x110
117 BYTE Reserved17[15]; // 0x121
118 BYTE Reserved18[3]; // 0x130
119 } BIOS_DATA_AREA, *PBIOS_DATA_AREA;
120 C_ASSERT(sizeof(BIOS_DATA_AREA) == 0x133);
121
122 /*
123 * BIOS Configuration Table at F000:E6F5 for 100% compatible BIOSes.
124 *
125 * See: http://www.ctyme.com/intr/rb-1594.htm
126 * for more information.
127 */
128 typedef struct _BIOS_CONFIG_TABLE
129 {
130 WORD Length; // 0x00
131 BYTE Model; // 0x02
132 BYTE SubModel; // 0x03
133 BYTE Revision; // 0x04
134 BYTE Feature[5]; // 0x05 -- 0x09
135 // Other BIOSes may extend this table. We don't.
136 } BIOS_CONFIG_TABLE, *PBIOS_CONFIG_TABLE;
137
138 #pragma pack(pop)
139
140 /* FUNCTIONS ******************************************************************/
141
142 extern PBIOS_DATA_AREA Bda;
143 extern PBIOS_CONFIG_TABLE Bct;
144
145 VOID WINAPI BiosEquipmentService(LPWORD Stack);
146 VOID WINAPI BiosGetMemorySize(LPWORD Stack);
147
148 BOOLEAN
149 BiosInitialize(IN LPCSTR BiosFileName);
150
151 VOID
152 BiosCleanup(VOID);
153
154 #endif // _BIOS_H_
155
156 /* EOF */