[NTVDM]
[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 0x2E // 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; // 0x89
101 BYTE VGADccIDActive; // 0x8a
102 DWORD Reserved3; // 0x8b
103 BYTE Reserved4; // 0x8f
104 BYTE Reserved5[2]; // 0x90
105 BYTE Reserved6[2]; // 0x92
106 BYTE Reserved7[2]; // 0x94
107 WORD KeybdStatusFlags; // 0x96
108 DWORD Reserved9; // 0x98
109 DWORD Reserved10; // 0x9c
110 DWORD Reserved11[2]; // 0xa0
111 DWORD EGAPtr; // 0xa8
112 BYTE Reserved12[68]; // 0xac
113 BYTE Reserved13[16]; // 0xf0
114
115 DWORD Reserved14; // 0x100
116 BYTE Reserved15[12]; // 0x104
117 BYTE Reserved16[17]; // 0x110
118 BYTE Reserved17[15]; // 0x121
119 BYTE Reserved18[3]; // 0x130
120 } BIOS_DATA_AREA, *PBIOS_DATA_AREA;
121 C_ASSERT(sizeof(BIOS_DATA_AREA) == 0x133);
122
123 /*
124 * BIOS Configuration Table at F000:E6F5 for 100% compatible BIOSes.
125 *
126 * See: http://www.ctyme.com/intr/rb-1594.htm
127 * for more information.
128 */
129 typedef struct _BIOS_CONFIG_TABLE
130 {
131 WORD Length; // 0x00
132 BYTE Model; // 0x02
133 BYTE SubModel; // 0x03
134 BYTE Revision; // 0x04
135 BYTE Feature[5]; // 0x05 -- 0x09
136 // Other BIOSes may extend this table. We don't.
137 } BIOS_CONFIG_TABLE, *PBIOS_CONFIG_TABLE;
138
139 #pragma pack(pop)
140
141 /* FUNCTIONS ******************************************************************/
142
143 extern PBIOS_DATA_AREA Bda;
144 extern PBIOS_CONFIG_TABLE Bct;
145
146 VOID WINAPI BiosEquipmentService(LPWORD Stack);
147 VOID WINAPI BiosGetMemorySize(LPWORD Stack);
148
149 BOOLEAN
150 BiosInitialize(IN LPCSTR BiosFileName);
151
152 VOID
153 BiosCleanup(VOID);
154
155 #endif // _BIOS_H_
156
157 /* EOF */