Sync with trunk r63383 .
[reactos.git] / subsystems / 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 "ntvdm.h"
15 #include "kbdbios.h"
16 #include "vidbios.h"
17
18 /* DEFINES ********************************************************************/
19
20 #define BDA_SEGMENT 0x40
21 #define BIOS_SEGMENT 0xF000
22
23 #define BIOS_EQUIPMENT_LIST 0x2C // HACK: Disable FPU for now
24
25 #pragma pack(push, 1)
26
27 /*
28 * BIOS Data Area at 0040:XXXX
29 *
30 * See: http://webpages.charter.net/danrollins/techhelp/0093.HTM
31 * and: http://www.bioscentral.com/misc/bda.htm
32 * for more information.
33 */
34 typedef struct
35 {
36 WORD SerialPorts[4]; // 0x00
37 WORD ParallelPorts[3]; // 0x08
38 WORD EbdaSegment; // 0x0e - ParallelPort in PC/XT
39 WORD EquipmentList; // 0x10
40 BYTE Reserved0; // 0x12 - Errors in PCjr infrared keyboard link
41 WORD MemorySize; // 0x13
42 WORD Reserved1; // 0x15 - Scratch pad for manufacturing error tests
43 WORD KeybdShiftFlags; // 0x17
44 BYTE AlternateKeypad; // 0x19
45 WORD KeybdBufferHead; // 0x1a
46 WORD KeybdBufferTail; // 0x1c
47 WORD KeybdBuffer[BIOS_KBD_BUFFER_SIZE]; // 0x1e
48 BYTE DriveRecalibrate; // 0x3e
49 BYTE DriveMotorStatus; // 0x3f
50 BYTE MotorShutdownCounter; // 0x40
51 BYTE LastDisketteOperation; // 0x41
52 BYTE Reserved2[7]; // 0x42
53 BYTE VideoMode; // 0x49
54 WORD ScreenColumns; // 0x4a
55 WORD VideoPageSize; // 0x4c
56 WORD VideoPageOffset; // 0x4e
57 WORD CursorPosition[BIOS_MAX_PAGES]; // 0x50
58 BYTE CursorEndLine; // 0x60
59 BYTE CursorStartLine; // 0x61
60 BYTE VideoPage; // 0x62
61 WORD CrtBasePort; // 0x63
62 BYTE CrtModeControl; // 0x65
63 BYTE CrtColorPaletteMask; // 0x66
64 BYTE CassetteData[5]; // 0x67
65 DWORD TickCounter; // 0x6c
66 BYTE MidnightPassed; // 0x70
67 BYTE BreakFlag; // 0x71
68 WORD SoftReset; // 0x72
69 BYTE LastDiskOperation; // 0x74
70 BYTE NumDisks; // 0x75
71 BYTE DriveControlByte; // 0x76
72 BYTE DiskPortOffset; // 0x77
73 BYTE LptTimeOut[4]; // 0x78
74 BYTE ComTimeOut[4]; // 0x7c
75 WORD KeybdBufferStart; // 0x80
76 WORD KeybdBufferEnd; // 0x82
77 BYTE ScreenRows; // 0x84
78 WORD CharacterHeight; // 0x85
79 BYTE EGAFlags[2]; // 0x87
80 BYTE VGAFlags[2]; // 0x89
81 DWORD Reserved3; // 0x8b
82 BYTE Reserved4; // 0x8f
83 BYTE Reserved5[2]; // 0x90
84 BYTE Reserved6[2]; // 0x92
85 BYTE Reserved7[2]; // 0x94
86 WORD Reserved8; // 0x96
87 DWORD Reserved9; // 0x98
88 DWORD Reserved10; // 0x9c
89 DWORD Reserved11[2]; // 0xa0
90 DWORD EGAPtr; // 0xa8
91 BYTE Reserved12[68]; // 0xac
92 BYTE Reserved13[16]; // 0xf0
93
94 DWORD Reserved14; // 0x100
95 BYTE Reserved15[12]; // 0x104
96 BYTE Reserved16[17]; // 0x110
97 BYTE Reserved17[15]; // 0x121
98 BYTE Reserved18[3]; // 0x130
99 } BIOS_DATA_AREA, *PBIOS_DATA_AREA;
100 C_ASSERT(sizeof(BIOS_DATA_AREA) == 0x133);
101
102 /*
103 * BIOS Configuration Table at F000:E6F5 for 100% compatible BIOSes.
104 *
105 * See: http://www.ctyme.com/intr/rb-1594.htm
106 * for more information.
107 */
108 typedef struct _BIOS_CONFIG_TABLE
109 {
110 WORD Length; // 0x00
111 BYTE Model; // 0x02
112 BYTE SubModel; // 0x03
113 BYTE BiosRevision; // 0x04
114 BYTE BiosFeature[5]; // 0x05 -- 0x09
115 // Other BIOSes may extend this table. We don't.
116 } BIOS_CONFIG_TABLE, *PBIOS_CONFIG_TABLE;
117
118 #pragma pack(pop)
119
120 /* FUNCTIONS ******************************************************************/
121
122 extern PBIOS_DATA_AREA Bda;
123 extern PBIOS_CONFIG_TABLE Bct;
124
125 VOID WINAPI BiosEquipmentService(LPWORD Stack);
126 VOID WINAPI BiosGetMemorySize(LPWORD Stack);
127
128 BOOLEAN
129 BiosInitialize(IN LPCSTR BiosFileName);
130
131 VOID
132 BiosCleanup(VOID);
133
134 #endif // _BIOS_H_
135
136 /* EOF */