ReactOS  0.4.13-dev-982-g9853eab
bios.h
Go to the documentation of this file.
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
46  BYTE Reserved0; // 0x12 - Errors in PCjr infrared keyboard link
47  WORD MemorySize; // 0x13
48  WORD Reserved1; // 0x15 - Scratch pad for manufacturing error tests
53  WORD KeybdBuffer[BIOS_KBD_BUFFER_SIZE]; // 0x1e
58  BYTE Reserved2[7]; // 0x42
59  BYTE VideoMode; // 0x49
63  WORD CursorPosition[BIOS_MAX_PAGES]; // 0x50
66  BYTE VideoPage; // 0x62
67  WORD CrtBasePort; // 0x63
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
80  WORD SoftReset; // 0x72
82  BYTE NumDisks; // 0x75
85  BYTE LptTimeOut[4]; // 0x78
86  BYTE ComTimeOut[4]; // 0x7c
89  BYTE ScreenRows; // 0x84
91  BYTE VGAOptions; // 0x87
92  BYTE VGASwitches; // 0x88
93  BYTE VGAFlags; // 0x89
95  DWORD Reserved3; // 0x8b
96  BYTE Reserved4; // 0x8f
97  BYTE FloppyDriveState[2]; // 0x90
98  BYTE Reserved6[2]; // 0x92
99  BYTE Reserved7[2]; // 0x94
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
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
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
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.
150 
151 #pragma pack(pop)
152 
153 /* FUNCTIONS ******************************************************************/
154 
155 extern PBIOS_DATA_AREA Bda;
156 extern PBIOS_CONFIG_TABLE Bct;
157 
160 
161 BOOLEAN
162 BiosInitialize(IN LPCSTR BiosFileName,
163  IN LPCSTR RomFiles OPTIONAL);
164 
165 VOID
167 
168 #endif // _BIOS_H_
169 
170 /* EOF */
DWORD Reserved3
Definition: bios.h:95
DWORD Basic3
Definition: bios.h:125
#define IN
Definition: typedefs.h:38
DWORD Reserved1
Definition: bios.h:131
BYTE VideoPage
Definition: bios.h:66
BYTE ScreenRows
Definition: bios.h:89
WORD VideoPageOffset
Definition: bios.h:62
#define BIOS_MAX_PAGES
Definition: vidbios.h:19
PBIOS_CONFIG_TABLE Bct
Definition: bios.c:43
BYTE VideoMode
Definition: bios.h:59
BYTE CursorStartLine
Definition: bios.h:65
BYTE VGASwitches
Definition: bios.h:92
WORD VideoPageSize
Definition: bios.h:61
DWORD ResumeEntryPoint
Definition: bios.h:74
WORD KeybdBufferStart
Definition: bios.h:87
DWORD Reserved9
Definition: bios.h:102
WORD CrtBasePort
Definition: bios.h:67
BYTE NumDisks
Definition: bios.h:82
VOID BiosCleanup(VOID)
Definition: bios.c:153
BYTE DriveRecalibrate
Definition: bios.h:54
BYTE DiskPortOffset
Definition: bios.h:84
struct _BIOS_CONFIG_TABLE * PBIOS_CONFIG_TABLE
BOOLEAN BiosInitialize(IN LPCSTR BiosFileName, IN LPCSTR RomFiles OPTIONAL)
Definition: bios.c:60
WORD KeybdShiftFlags
Definition: bios.h:49
WORD KeybdBufferEnd
Definition: bios.h:88
BYTE MidnightPassed
Definition: bios.h:78
WORD CharacterHeight
Definition: bios.h:90
WORD MemorySize
Definition: bios.h:47
unsigned char BOOLEAN
BYTE MotorShutdownCounter
Definition: bios.h:56
BYTE LastDiskOperation
Definition: bios.h:81
const char * LPCSTR
Definition: xmlstorage.h:183
Definition: bcd.h:202
BYTE KeybdStatusFlags
Definition: bios.h:100
BYTE Feature[5]
Definition: bios.h:147
struct _BIOS_CONFIG_TABLE BIOS_CONFIG_TABLE
BYTE SingleDisketteFlag
Definition: bios.h:121
WORD Reserved0
Definition: bios.h:128
#define WINAPI
Definition: msvc.h:8
WORD KeybdBufferHead
Definition: bios.h:51
BYTE LastDisketteOperation
Definition: bios.h:57
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
BYTE DriveMotorStatus
Definition: bios.h:55
DWORD EGAPtr
Definition: bios.h:105
DWORD Reserved10
Definition: bios.h:103
BYTE DriveControlByte
Definition: bios.h:83
WORD DynStorage
Definition: bios.h:129
unsigned char BYTE
Definition: mem.h:68
WORD KeybdBufferTail
Definition: bios.h:52
DWORD TickCounter
Definition: bios.h:77
BYTE Reserved0
Definition: bios.h:46
C_ASSERT(sizeof(BIOS_DATA_AREA)==0x100)
WORD ScreenColumns
Definition: bios.h:60
uint16_t * LPWORD
Definition: typedefs.h:54
BYTE CrtModeControl
Definition: bios.h:68
WORD Basic2
Definition: bios.h:124
DWORD Basic4
Definition: bios.h:126
BYTE VGADccIDActive
Definition: bios.h:94
BYTE AlternateKeypad
Definition: bios.h:50
#define BIOS_KBD_BUFFER_SIZE
Definition: kbdbios32.h:16
WORD EbdaSegment
Definition: bios.h:44
BYTE KeybdLedFlags
Definition: bios.h:101
BYTE VGAOptions
Definition: bios.h:91
BYTE Reserved4
Definition: bios.h:96
BYTE VGAFlags
Definition: bios.h:93
WORD EquipmentList
Definition: bios.h:45
PBIOS_DATA_AREA Bda
Definition: bios.c:42
struct USER_DATA_AREA * PUSER_DATA_AREA
BYTE PrintScreen
Definition: bios.h:119
DWORD Basic5
Definition: bios.h:127
BYTE CtrlBreakFlag
Definition: bios.h:79
struct BIOS_DATA_AREA * PBIOS_DATA_AREA
WORD SoftReset
Definition: bios.h:80
VOID WINAPI BiosEquipmentService(LPWORD Stack)
Definition: bios32.c:200
BYTE Basic1
Definition: bios.h:123
BYTE CrtColorPaletteMask
Definition: bios.h:69
WORD Reserved1
Definition: bios.h:48
VOID WINAPI BiosGetMemorySize(LPWORD Stack)
Definition: bios32.c:206
BYTE CursorEndLine
Definition: bios.h:64
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68