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 *******************************************************************/
18 /* DEFINES ********************************************************************/
21 #define BOP_RESET 0x00 // Windows NTVDM (SoftPC) BIOS calls BOP 0x00
22 // to let the virtual machine initialize itself
23 // the IVT and its hardware.
24 #define BOP_EQUIPLIST 0x11
25 #define BOP_GETMEMSIZE 0x12
30 #define BDA_SEGMENT 0x40
31 #define BIOS_SEGMENT 0xF000
33 // HACK: Disable FPU for now because it is not fully ready yet for being used
34 // by all applications (e.g. QBasic runtime would use the native FPU if the bit
35 // is set, but then subsequently fails, unless the FPU bit is unset in that case
36 // QBasic uses its emulated FPU).
37 #define BIOS_EQUIPMENT_LIST 0x2C // Bit1: FPU, Bit 2: Mouse
42 * BIOS Data Area at 0040:XXXX
44 * See: http://webpages.charter.net/danrollins/techhelp/0093.HTM
45 * and: http://www.bioscentral.com/misc/bda.htm
46 * for more information.
50 WORD SerialPorts
[4]; // 0x00
51 WORD ParallelPorts
[3]; // 0x08
52 WORD EbdaSegment
; // 0x0e - ParallelPort in PC/XT
53 WORD EquipmentList
; // 0x10
54 BYTE Reserved0
; // 0x12 - Errors in PCjr infrared keyboard link
55 WORD MemorySize
; // 0x13
56 WORD Reserved1
; // 0x15 - Scratch pad for manufacturing error tests
57 WORD KeybdShiftFlags
; // 0x17
58 BYTE AlternateKeypad
; // 0x19
59 WORD KeybdBufferHead
; // 0x1a
60 WORD KeybdBufferTail
; // 0x1c
61 WORD KeybdBuffer
[BIOS_KBD_BUFFER_SIZE
]; // 0x1e
62 BYTE DriveRecalibrate
; // 0x3e
63 BYTE DriveMotorStatus
; // 0x3f
64 BYTE MotorShutdownCounter
; // 0x40
65 BYTE LastDisketteOperation
; // 0x41
66 BYTE Reserved2
[7]; // 0x42
67 BYTE VideoMode
; // 0x49
68 WORD ScreenColumns
; // 0x4a
69 WORD VideoPageSize
; // 0x4c
70 WORD VideoPageOffset
; // 0x4e
71 WORD CursorPosition
[BIOS_MAX_PAGES
]; // 0x50
72 BYTE CursorEndLine
; // 0x60
73 BYTE CursorStartLine
; // 0x61
74 BYTE VideoPage
; // 0x62
75 WORD CrtBasePort
; // 0x63
76 BYTE CrtModeControl
; // 0x65
77 BYTE CrtColorPaletteMask
; // 0x66
78 BYTE CassetteData
[5]; // 0x67
79 DWORD TickCounter
; // 0x6c
80 BYTE MidnightPassed
; // 0x70
81 BYTE BreakFlag
; // 0x71
82 WORD SoftReset
; // 0x72
83 BYTE LastDiskOperation
; // 0x74
84 BYTE NumDisks
; // 0x75
85 BYTE DriveControlByte
; // 0x76
86 BYTE DiskPortOffset
; // 0x77
87 BYTE LptTimeOut
[4]; // 0x78
88 BYTE ComTimeOut
[4]; // 0x7c
89 WORD KeybdBufferStart
; // 0x80
90 WORD KeybdBufferEnd
; // 0x82
91 BYTE ScreenRows
; // 0x84
92 WORD CharacterHeight
; // 0x85
93 BYTE VGAOptions
; // 0x87
94 BYTE VGASwitches
; // 0x88
95 BYTE VGAFlags
[2]; // 0x89
96 DWORD Reserved3
; // 0x8b
97 BYTE Reserved4
; // 0x8f
98 BYTE Reserved5
[2]; // 0x90
99 BYTE Reserved6
[2]; // 0x92
100 BYTE Reserved7
[2]; // 0x94
101 WORD KeybdStatusFlags
; // 0x96
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 DWORD Reserved14
; // 0x100
110 BYTE Reserved15
[12]; // 0x104
111 BYTE Reserved16
[17]; // 0x110
112 BYTE Reserved17
[15]; // 0x121
113 BYTE Reserved18
[3]; // 0x130
114 } BIOS_DATA_AREA
, *PBIOS_DATA_AREA
;
115 C_ASSERT(sizeof(BIOS_DATA_AREA
) == 0x133);
118 * BIOS Configuration Table at F000:E6F5 for 100% compatible BIOSes.
120 * See: http://www.ctyme.com/intr/rb-1594.htm
121 * for more information.
123 typedef struct _BIOS_CONFIG_TABLE
127 BYTE SubModel
; // 0x03
128 BYTE Revision
; // 0x04
129 BYTE Feature
[5]; // 0x05 -- 0x09
130 // Other BIOSes may extend this table. We don't.
131 } BIOS_CONFIG_TABLE
, *PBIOS_CONFIG_TABLE
;
135 /* FUNCTIONS ******************************************************************/
137 extern PBIOS_DATA_AREA Bda
;
138 extern PBIOS_CONFIG_TABLE Bct
;
140 VOID WINAPI
BiosEquipmentService(LPWORD Stack
);
141 VOID WINAPI
BiosGetMemorySize(LPWORD Stack
);
144 BiosInitialize(IN LPCSTR BiosFileName
);