2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
5 * PURPOSE: VDM BIOS Support Library
6 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
12 /* INCLUDES *******************************************************************/
17 /* DEFINES ********************************************************************/
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
29 #define BDA_SEGMENT 0x40
30 #define BIOS_SEGMENT 0xF000
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
41 * BIOS Data Area at 0040:XXXX
43 * See: http://webpages.charter.net/danrollins/techhelp/0093.HTM
44 * and: http://www.bioscentral.com/misc/bda.htm
45 * for more information.
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
80 BYTE CassetteData
[5]; // Cassette tape control (unused)
81 DWORD ResumeEntryPoint
; // CS:IP for 286 return from Protected Mode
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
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);
124 * BIOS Configuration Table at F000:E6F5 for 100% compatible BIOSes.
126 * See: http://www.ctyme.com/intr/rb-1594.htm
127 * for more information.
129 typedef struct _BIOS_CONFIG_TABLE
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
;
141 /* FUNCTIONS ******************************************************************/
143 extern PBIOS_DATA_AREA Bda
;
144 extern PBIOS_CONFIG_TABLE Bct
;
146 VOID WINAPI
BiosEquipmentService(LPWORD Stack
);
147 VOID WINAPI
BiosGetMemorySize(LPWORD Stack
);
150 BiosInitialize(IN LPCSTR BiosFileName
);