ReactOS 0.4.15-dev-7942-gd23573b
bios32.c File Reference
#include "ntvdm.h"
#include <reactos/buildno.h>
#include <reactos/version.h>
#include <debug.h>
#include "emulator.h"
#include "cpu/cpu.h"
#include "cpu/bop.h"
#include "int32.h"
#include <isvbop.h>
#include <bios/bios.h>
#include <bios/rom.h>
#include "bios32.h"
#include "bios32p.h"
#include "dskbios32.h"
#include "kbdbios32.h"
#include "vidbios32.h"
#include "moubios32.h"
#include "memory.h"
#include "io.h"
#include "hardware/cmos.h"
#include "hardware/pic.h"
#include "hardware/pit.h"
#include "hardware/ps2.h"
Include dependency graph for bios32.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define BIOS_MODEL   0xFC
 
#define BIOS_SUBMODEL   0x01
 
#define BIOS_REVISION   0x00
 

Functions

 C_ASSERT (sizeof(BiosCopyright) -1<=0x5B)
 
 C_ASSERT (sizeof(BiosDate) -1==0x08)
 
static VOID BiosCharPrint (CHAR Character)
 
static VOID WINAPI BiosException (LPWORD Stack)
 
VOID WINAPI BiosEquipmentService (LPWORD Stack)
 
VOID WINAPI BiosGetMemorySize (LPWORD Stack)
 
static VOID WINAPI BiosMiscService (LPWORD Stack)
 
static VOID WINAPI BiosRomBasic (LPWORD Stack)
 
VOID DosBootsectorInitialize (VOID)
 
VOID WINAPI BiosDiskService (LPWORD Stack)
 
static VOID WINAPI BiosBootstrapLoader (LPWORD Stack)
 
static VOID WINAPI BiosTimeService (LPWORD Stack)
 
static VOID WINAPI BiosSystemTimerInterrupt (LPWORD Stack)
 
static VOID PicSetIRQMask (USHORT off, USHORT on)
 
VOID EnableHwIRQ (UCHAR hwirq, EMULATOR_INT32_PROC func)
 
VOID PicIRQComplete (BYTE IntNum)
 
static VOID WINAPI BiosHandleMasterPicIRQ (LPWORD Stack)
 
static VOID WINAPI BiosHandleSlavePicIRQ (LPWORD Stack)
 
static VOID WINAPI BiosTimerIrq (LPWORD Stack)
 
static VOID BiosHwSetup (VOID)
 
static VOID InitializeBiosInt32 (VOID)
 
static VOID InitializeBiosData (VOID)
 
VOID WINAPI Bios32Post (LPWORD Stack)
 
BOOLEAN Bios32Initialize (VOID)
 
VOID Bios32Cleanup (VOID)
 

Variables

CALLBACK16 BiosContext
 
static const BIOS_CONFIG_TABLE BiosConfigTable
 
static const CHAR BiosCopyright [] = "0000000 NTVDM IBM COMPATIBLE 486 BIOS COPYRIGHT (C) ReactOS Team 1996-"COPYRIGHT_YEAR
 
static const CHAR BiosVersion []
 
static const CHAR BiosDate [] = "06/17/13"
 
static const BYTE Bootstrap []
 
static const BYTE PostCode []
 

Macro Definition Documentation

◆ BIOS_MODEL

#define BIOS_MODEL   0xFC

Definition at line 110 of file bios32.c.

◆ BIOS_REVISION

#define BIOS_REVISION   0x00

Definition at line 112 of file bios32.c.

◆ BIOS_SUBMODEL

#define BIOS_SUBMODEL   0x01

Definition at line 111 of file bios32.c.

◆ NDEBUG

#define NDEBUG

Definition at line 18 of file bios32.c.

Function Documentation

◆ Bios32Cleanup()

VOID Bios32Cleanup ( VOID  )

Definition at line 1289 of file bios32.c.

1290{
1295}
VOID DiskBios32Cleanup(VOID)
Definition: dskbios32.c:701
VOID KbdBiosCleanup(VOID)
Definition: kbdbios.c:93
VOID MouseBios32Cleanup(VOID)
Definition: moubios32.c:538
VOID VidBios32Cleanup(VOID)
Definition: vidbios32.c:67

Referenced by BiosCleanup().

◆ Bios32Initialize()

BOOLEAN Bios32Initialize ( VOID  )

Definition at line 1246 of file bios32.c.

1247{
1248 /*
1249 * Initialize BIOS/Keyboard/Video ROM static data
1250 */
1251
1252 /* System BIOS Copyright */
1254
1255 /* System BIOS Version */
1257
1258 /* System BIOS Date */
1260
1261 /* Bootstrap code */
1264
1265 /* BIOS ROM Information */
1267
1268 /* System BIOS Model (same as Bct->Model) */
1270
1271 /* Initialize the Keyboard and Video BIOS */
1273 {
1274 /* Stop the VDM */
1276 return FALSE;
1277 }
1278
1279 /* Redefine our POST function */
1281
1283 ROM_AREA_END - TO_LINEAR(BIOS_SEGMENT, 0x0000) + 1);
1284
1285 /* We are done */
1286 return TRUE;
1287}
static const CHAR BiosVersion[]
Definition: bios32.c:139
static const CHAR BiosDate[]
Definition: bios32.c:141
#define BIOS_MODEL
Definition: bios32.c:110
static const BYTE PostCode[]
Definition: bios32.c:157
static const CHAR BiosCopyright[]
Definition: bios32.c:138
VOID WINAPI Bios32Post(LPWORD Stack)
Definition: bios32.c:1068
static const BYTE Bootstrap[]
Definition: bios32.c:147
static const BIOS_CONFIG_TABLE BiosConfigTable
Definition: bios32.c:115
#define BIOS_SEGMENT
Definition: bios.h:29
VOID RegisterBop(BYTE BopCode, EMULATOR_BOP_PROC BopHandler)
Definition: bop.c:29
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOLEAN DiskBios32Initialize(VOID)
Definition: dskbios32.c:674
VOID EmulatorTerminate(VOID)
Definition: emulator.c:503
#define TO_LINEAR(seg, off)
Definition: emulator.h:26
#define SEG_OFF_TO_PTR(seg, off)
Definition: emulator.h:32
BOOLEAN KbdBiosInitialize(VOID)
Definition: kbdbios.c:85
BOOLEAN MouseBiosInitialize(VOID)
Definition: moubios32.c:533
BYTE * PBYTE
Definition: pedump.c:66
BOOLEAN WriteProtectRom(IN PVOID RomLocation, IN ULONG RomSize)
Definition: rom.c:138
#define ROM_AREA_END
Definition: rom.h:15
#define BOP_RESET
Definition: bios.c:33
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
BOOLEAN VidBiosInitialize(VOID)
Definition: vidbios.c:3981

Referenced by BiosInitialize().

◆ Bios32Post()

VOID WINAPI Bios32Post ( LPWORD  Stack)

Definition at line 1068 of file bios32.c.

1069{
1070 static BOOLEAN FirstBoot = TRUE;
1071 BYTE ShutdownStatus;
1072
1073 /*
1074 * Initialize BIOS/Keyboard/Video RAM dynamic data
1075 */
1076
1077 DPRINT("Bios32Post\n");
1078
1079 /* Disable interrupts */
1080 setIF(0);
1081
1082 /* Set the data segment */
1084
1085 /* Initialize the stack */
1086 // Temporary stack for POST (to be used only before initializing the INT vectors)
1087 // setSS(0x0000);
1088 // setSP(0x0400);
1089 //
1090 // Stack to be used after the initialization of the INT vectors
1091 setSS(0x0000); // Stack at 00:8000, going downwards
1092 setSP(0x8000);
1093
1094 /*
1095 * Perform early CMOS shutdown status checks
1096 */
1097
1098 /* Read the CMOS shutdown status byte and reset it */
1100 ShutdownStatus = IOReadB(CMOS_DATA_PORT);
1102 IOWriteB(CMOS_DATA_PORT, 0x00);
1103
1104 DPRINT1("Bda->SoftReset = 0x%04X ; ShutdownStatus = 0x%02X\n",
1105 Bda->SoftReset, ShutdownStatus);
1106
1107 switch (ShutdownStatus)
1108 {
1109 /* Shutdown after Memory Tests (unsupported) */
1110 case 0x01: case 0x02: case 0x03:
1111 /* Shutdown after Protected Mode Tests (unsupported) */
1112 case 0x06: case 0x07: case 0x08:
1113 /* Shutdown after Block Move Test (unsupported) */
1114 case 0x09:
1115 {
1116 DisplayMessage(L"Unsupported CMOS Shutdown Status value 0x%02X. The VDM will shut down.", ShutdownStatus);
1118 return;
1119 }
1120
1121 /* Shutdown to Boot Loader */
1122 case 0x04:
1123 {
1124 DPRINT1("Fast restart to Bootstrap Loader...\n");
1125 goto Quit; // Reenable interrupts and exit.
1126 }
1127
1128 /* Flush keyboard, issue an EOI... */
1129 case 0x05:
1130 {
1132
1133 /* Send EOI */
1136
1137 // Fall back
1138 }
1139
1140 /*
1141 * ... and far JMP to user-specified location at 0040:0067
1142 * (Bda->ResumeEntryPoint) with interrupts and NMI disabled.
1143 */
1144 case 0x0A:
1145 {
1146 DPRINT1("Bda->ResumeEntryPoint = %04X:%04X\n",
1149
1150 /* Position execution pointers and return with interrupts disabled */
1153 return;
1154 }
1155
1156 /* Soft reset or unexpected shutdown... */
1157 case 0x00:
1158 /* ... or other possible shutdown codes: just continue the POST */
1159 default:
1160 break;
1161 }
1162
1163 /*
1164 * FIXME: UNIMPLEMENTED!
1165 * Check the word at 0040h:0072h (Bda->SoftReset) and do one of the
1166 * following actions:
1167 * - if the word is 0000h, perform a cold reboot (aka. Reset). Everything gets initialized.
1168 * - if the word is 1234h, perform a warm reboot (aka. Ctrl-Alt-Del). Some stuff is skipped.
1169 */
1170 switch (Bda->SoftReset)
1171 {
1172 case 0x0000:
1173 {
1174 if (!FirstBoot)
1175 {
1176 DisplayMessage(L"NTVDM is performing a COLD reboot! The program you are currently testing does not seem to behave correctly! The VDM will shut down...");
1178 return;
1179 }
1180 break;
1181 }
1182
1183 case 0x1234:
1184 {
1185 DisplayMessage(L"NTVDM is performing a WARM reboot! This is not supported at the moment. The VDM will shut down...");
1187 return;
1188 }
1189
1190 default:
1191 break;
1192 }
1193
1194 FirstBoot = FALSE;
1195
1196 /* Initialize the BDA */
1198
1199 /* Initialize the User Data Area at 0050:XXXX */
1200 RtlZeroMemory(SEG_OFF_TO_PTR(0x50, 0x0000), sizeof(USER_DATA_AREA));
1201
1202
1203
1205
1206 /*
1207 * Initialize IVT and hardware
1208 */
1209
1210 // WriteUnProtectRom(...);
1211
1212 /* Register the BIOS 32-bit Interrupts */
1214
1215 /* Initialize platform hardware (PIC/PIT chips, ...) */
1216 BiosHwSetup();
1217
1218 /* Initialize the Keyboard, Video and Mouse BIOS */
1219 KbdBios32Post();
1220 VidBiosPost();
1223
1224 // WriteProtectRom(...);
1225
1227
1228
1229
1231
1232 /*
1233 * End of the 32-bit POST portion. We then fall back into 16-bit where
1234 * the rest of the POST code is executed, typically calling INT 19h
1235 * to boot up the OS.
1236 */
1237
1238Quit:
1239 /* Enable interrupts */
1240 setIF(1);
1241}
unsigned char BOOLEAN
#define DPRINT1
Definition: precomp.h:8
static VOID InitializeBiosData(VOID)
Definition: bios32.c:1036
static VOID BiosHwSetup(VOID)
Definition: bios32.c:897
CALLBACK16 BiosContext
Definition: bios32.c:45
static VOID InitializeBiosInt32(VOID)
Definition: bios32.c:960
#define BDA_SEGMENT
Definition: bios.h:28
#define CMOS_DISABLE_NMI
Definition: cmos.h:17
@ CMOS_REG_SHUTDOWN_STATUS
Definition: cmos.h:67
#define CMOS_ADDRESS_PORT
Definition: cmos.h:15
VOID DiskBios32Post(VOID)
Definition: dskbios32.c:647
#define CMOS_DATA_PORT
Definition: halhw.h:12
VOID KbdBios32Post(VOID)
Definition: kbdbios32.c:361
VOID MouseBios32Post(VOID)
Definition: moubios32.c:486
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define PS2_DATA_PORT
Definition: ps2.h:16
void DisplayMessage(BOOL bConsole, BOOL bSilent, LPCTSTR lpMessage, LPCTSTR lpTitle, UINT uType)
Definition: regsvr32.c:239
VOID SearchAndInitRoms(IN PCALLBACK16 Context)
Definition: rom.c:252
#define DPRINT
Definition: sndvol32.h:71
DWORD ResumeEntryPoint
Definition: bios.h:74
WORD SoftReset
Definition: bios.h:80
PBIOS_DATA_AREA Bda
Definition: bios.c:42
#define PIC_OCW2_EOI
Definition: pic.h:27
#define PIC_MASTER_CMD
Definition: pic.h:15
#define PIC_SLAVE_CMD
Definition: pic.h:17
VOID IOWriteB(USHORT Port, UCHAR Buffer)
Definition: io.c:111
UCHAR IOReadB(USHORT Port)
Definition: io.c:64
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define HIWORD(l)
Definition: typedefs.h:247
VOID WINAPI setIF(ULONG)
Definition: registers.c:643
VOID WINAPI setSP(USHORT)
Definition: registers.c:351
VOID WINAPI setDS(USHORT)
Definition: registers.c:515
VOID WINAPI setCS(USHORT)
Definition: registers.c:487
VOID WINAPI setSS(USHORT)
Definition: registers.c:501
VOID WINAPI setIP(USHORT)
Definition: registers.c:471
VOID VidBiosPost(VOID)
Definition: vidbios.c:3932
unsigned char BYTE
Definition: xxhash.c:193

Referenced by Bios32Initialize().

◆ BiosBootstrapLoader()

static VOID WINAPI BiosBootstrapLoader ( LPWORD  Stack)
static

Definition at line 567 of file bios32.c.

568{
569 USHORT BootOrder;
570
571 USHORT AX, BX, CX, DX, ES;
572 AX = getAX();
573 BX = getBX();
574 CX = getCX();
575 DX = getDX();
576 ES = getES();
577
578 /*
579 * Read the boot sequence order from the CMOS, old behaviour AMI-style.
580 *
581 * For more information, see:
582 * http://www.virtualbox.org/svn/vbox/trunk/src/VBox/Devices/PC/BIOS/orgs.asm
583 * http://www.virtualbox.org/svn/vbox/trunk/src/VBox/Devices/PC/BIOS/boot.c
584 * http://bochs.sourceforge.net/cgi-bin/lxr/source/iodev/cmos.cc
585 * https://web.archive.org/web/20111209041013/http://www-ivs.cs.uni-magdeburg.de/~zbrog/asm/cmos.html
586 * http://www.bioscentral.com/misc/cmosmap.htm
587 */
589 BootOrder = (IOReadB(CMOS_DATA_PORT) & 0x20) >> 5;
590
591 /*
592 * BootOrder =
593 * 0: Hard Disk, then Floppy Disk
594 * 1: Floppy Disk, then Hard Disk
595 * In all cases, if booting from those devices failed,
596 * ROM DOS-32 is started. If it fails, INT 18h is called.
597 */
598
599 DPRINT("BiosBootstrapLoader (BootOrder = 0x%02X) -->\n", BootOrder);
600
601 /*
602 * Format of the BootOrder command:
603 * 2 bytes. Each half-byte contains the ID of the drive to boot.
604 * Currently defined:
605 * 0x0: 1st Floppy disk
606 * 0x1: 1st Hard disk
607 * Other, or 0xF: Stop boot sequence.
608 */
609 BootOrder = 0xFF00 | ((1 << (4 * BootOrder)) & 0xFF);
610
611Retry:
612 switch (BootOrder & 0x0F)
613 {
614 /* Boot from 1st floppy drive */
615 case 0:
616 {
617 setAH(0x02); // Read sectors
618 setAL(0x01); // Number of sectors
619 setDH(0x00); // Head 0
620 setCH(0x00); // Cylinder 0
621 setCL(0x01); // Sector 1
622 setDL(0x00); // First diskette drive (used by loader code, so should not be cleared)
623 setES(0x0000); // Write data in 0000:7C00
624 setBX(0x7C00);
626 if (!(Stack[STACK_FLAGS] & EMULATOR_FLAG_CF)) goto Quit;
627#ifdef ADVANCED_DEBUGGING
628 DPRINT1("An error happened while loading the bootsector from floppy 0, error = %d\n", getAH());
629#endif
630
631 break;
632 }
633
634 /* Boot from 1st HDD drive */
635 case 1:
636 {
637 setAH(0x02); // Read sectors
638 setAL(0x01); // Number of sectors
639 setDH(0x00); // Head 0
640 setCH(0x00); // Cylinder 0
641 setCL(0x01); // Sector 1
642 setDL(0x80); // First HDD drive (used by loader code, so should not be cleared)
643 setES(0x0000); // Write data in 0000:7C00
644 setBX(0x7C00);
646 if (!(Stack[STACK_FLAGS] & EMULATOR_FLAG_CF)) goto Quit;
647#ifdef ADVANCED_DEBUGGING
648 DPRINT1("An error happened while loading the bootsector from HDD 0, error = %d\n", getAH());
649#endif
650
651 break;
652 }
653
654 default:
655 goto StartDos;
656 }
657
658 /* Go to next drive and invalidate the last half-byte. */
659 BootOrder = (BootOrder >> 4) | 0xF000;
660 goto Retry;
661
662StartDos:
663 /* Clear everything, we are going to load DOS32 */
664 setAX(AX);
665 setBX(BX);
666 setCX(CX);
667 setDX(DX);
668 setES(ES);
669 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
670
671 /* Load our DOS */
673
674Quit:
675 /*
676 * Jump to 0000:7C00 to boot the OS.
677 *
678 * Since we are called via the INT32 mechanism, we need to correctly set
679 * CS:IP, not by changing the current one (otherwise the interrupt could
680 * not be clean up and return properly), but by changing the CS:IP in the
681 * stack, so that when the interrupt returns, the modified CS:IP is popped
682 * off the stack and the CPU is correctly repositioned.
683 */
684 Stack[STACK_CS] = 0x0000;
685 Stack[STACK_IP] = 0x7C00;
686
687 DPRINT("<-- BiosBootstrapLoader\n");
688}
VOID DosBootsectorInitialize(VOID)
Definition: dem.c:1089
VOID WINAPI BiosDiskService(LPWORD Stack)
Definition: dskbios32.c:164
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEAN * Retry
Definition: classpnp.h:312
@ CMOS_REG_SYSOP
Definition: cmos.h:73
#define DX
Definition: i386-dis.c:425
#define AX
Definition: i386-dis.c:424
#define STACK_IP
Definition: int32.h:33
#define STACK_FLAGS
Definition: int32.h:35
#define STACK_CS
Definition: int32.h:34
@ ES
Definition: bidi.c:78
unsigned short USHORT
Definition: pedump.c:61
#define EMULATOR_FLAG_CF
Definition: cpu.h:19
VOID WINAPI setBX(USHORT)
Definition: registers.c:177
VOID WINAPI setCX(USHORT)
Definition: registers.c:235
VOID WINAPI setCH(UCHAR)
Definition: registers.c:249
VOID WINAPI setDX(USHORT)
Definition: registers.c:293
USHORT WINAPI getBX(VOID)
Definition: registers.c:170
VOID WINAPI setAL(UCHAR)
Definition: registers.c:149
VOID WINAPI setDL(UCHAR)
Definition: registers.c:321
VOID WINAPI setAH(UCHAR)
Definition: registers.c:135
USHORT WINAPI getCX(VOID)
Definition: registers.c:228
USHORT WINAPI getDX(VOID)
Definition: registers.c:286
USHORT WINAPI getAX(VOID)
Definition: registers.c:114
USHORT WINAPI getES(VOID)
Definition: registers.c:522
VOID WINAPI setDH(UCHAR)
Definition: registers.c:307
VOID WINAPI setAX(USHORT)
Definition: registers.c:121
VOID WINAPI setES(USHORT)
Definition: registers.c:529
VOID WINAPI setCL(UCHAR)
Definition: registers.c:263
UCHAR WINAPI getAH(VOID)
Definition: registers.c:128
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639

Referenced by InitializeBiosInt32().

◆ BiosCharPrint()

static VOID BiosCharPrint ( CHAR  Character)
static

Definition at line 168 of file bios32.c.

169{
170 /* Save AX and BX */
171 USHORT AX = getAX();
172 USHORT BX = getBX();
173
174 /*
175 * Set the parameters:
176 * AL contains the character to print,
177 * BL contains the character attribute,
178 * BH contains the video page to use.
179 */
180 setAL(Character);
183
184 /* Call the BIOS INT 10h, AH=0Eh "Teletype Output" */
185 setAH(0x0E);
187
188 /* Restore AX and BX */
189 setBX(BX);
190 setAX(AX);
191}
VOID Int32Call(IN PCALLBACK16 Context, IN BYTE IntNumber)
Definition: int32.c:151
BYTE VideoPage
Definition: bios.h:66
VOID WINAPI setBL(UCHAR)
Definition: registers.c:205
VOID WINAPI setBH(UCHAR)
Definition: registers.c:191
#define DEFAULT_ATTRIBUTE
Definition: vidbios.h:21
#define BIOS_VIDEO_INTERRUPT
Definition: vidbios.h:15

Referenced by BiosRomBasic().

◆ BiosDiskService()

VOID WINAPI BiosDiskService ( LPWORD  Stack)

Definition at line 164 of file dskbios32.c.

165{
166 BYTE Drive;
167 PDISK_IMAGE DiskImage;
168
169 switch (getAH())
170 {
171 /* Disk -- Reset Disk System */
172 case 0x00:
173 {
174 Drive = getDL();
175
176 if (Drive & 0x80)
177 {
179
180 /* Return success */
181 setAH(0x00);
182 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
183 break;
184 }
185
186 Drive &= ~0x80;
187
189 {
190 DPRINT1("BiosDiskService(0x00): Drive number 0x%02X invalid\n", Drive);
191
192 /* Return error */
193 setAH(0x01);
195 break;
196 }
197
198 // TODO: Reset drive
199
200 /* Return success */
201 setAH(0x00);
202 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
203 break;
204 }
205
206 /* Disk -- Get Status of Last Operation */
207 case 0x01:
208 {
209 BYTE LastOperationStatus = 0x00;
210
211 Drive = getDL();
212 DiskImage = GetDisk(Drive);
213 if (!DiskImage || !IsDiskPresent(DiskImage))
214 {
215 DPRINT1("BiosDiskService(0x01): Disk number 0x%02X invalid\n", Drive);
216
217 /* Return error */
218 setAH(0x01);
220 break;
221 }
222
223 LastOperationStatus = DiskImage->LastOperationStatus;
224
225 if (Drive & 0x80)
226 Bda->LastDiskOperation = LastOperationStatus;
227 else
228 Bda->LastDisketteOperation = LastOperationStatus;
229
230 /* Return last error */
231 setAH(LastOperationStatus);
232 if (LastOperationStatus == 0x00)
233 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
234 else
236
237 break;
238 }
239
240 /* Disk -- Read Sectors into Memory */
241 case 0x02:
242 {
243 BYTE Status;
244 BYTE Head = getDH();
245 BYTE NumSectors = getAL();
246
247 // CH: Low eight bits of cylinder number
248 // CL: High two bits of cylinder (bits 6-7, hard disk only)
249 WORD Cylinder = MAKEWORD(getCH(), (getCL() >> 6) & 0x02);
250
251 // CL: Sector number 1-63 (bits 0-5)
252 BYTE Sector = (getCL() & 0x3F); // 1-based
253
254 Drive = getDL();
255 DiskImage = GetDisk(Drive);
256 if (!DiskImage || !IsDiskPresent(DiskImage))
257 {
258 DPRINT1("BiosDiskService(0x02): Disk number 0x%02X invalid\n", Drive);
259
260 /* Return error */
261 setAH(0x01);
263 break;
264 }
265
266 /* Read the sectors */
267 Status = ReadDisk(DiskImage, Cylinder, Head, Sector, NumSectors);
268 if (Status == 0x00)
269 {
270 /* Return success */
271 setAH(0x00);
272 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
273 }
274 else
275 {
276 DPRINT1("BiosDiskService(0x02): Error when reading from disk number 0x%02X (0x%02X)\n", Drive, Status);
277
278 /* Return error */
279 setAH(Status);
281 }
282
283 break;
284 }
285
286 /* Disk -- Write Disk Sectors */
287 case 0x03:
288 {
289 BYTE Status;
290 BYTE Head = getDH();
291 BYTE NumSectors = getAL();
292
293 // CH: Low eight bits of cylinder number
294 // CL: High two bits of cylinder (bits 6-7, hard disk only)
295 WORD Cylinder = MAKEWORD(getCH(), (getCL() >> 6) & 0x02);
296
297 // CL: Sector number 1-63 (bits 0-5)
298 BYTE Sector = (getCL() & 0x3F); // 1-based
299
300 Drive = getDL();
301 DiskImage = GetDisk(Drive);
302 if (!DiskImage || !IsDiskPresent(DiskImage))
303 {
304 DPRINT1("BiosDiskService(0x03): Disk number 0x%02X invalid\n", Drive);
305
306 /* Return error */
307 setAH(0x01);
309 break;
310 }
311
312 /* Write the sectors */
313 Status = WriteDisk(DiskImage, Cylinder, Head, Sector, NumSectors);
314 if (Status == 0x00)
315 {
316 /* Return success */
317 setAH(0x00);
318 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
319 }
320 else
321 {
322 DPRINT1("BiosDiskService(0x03): Error when writing to disk number 0x%02X (0x%02X)\n", Drive, Status);
323
324 /* Return error */
325 setAH(Status);
327 }
328
329 break;
330 }
331
332 /* Disk -- Verify Disk Sectors */
333 case 0x04:
334
335 /* Floppy/Fixed Disk -- Format Track */
336 case 0x05:
337
338 /* Fixed Disk -- Format Track and Set Bad Sector Flags */
339 case 0x06:
340
341 /* Fixed Disk -- Format Drive starting at Given Track */
342 case 0x07:
343 goto Default;
344
345 /* Disk -- Get Drive Parameters */
346 case 0x08:
347 {
348 WORD MaxCylinders;
349 BYTE MaxHeads;
350 BYTE PresentDrives = 0;
351 BYTE i;
352
353 Drive = getDL();
354 DiskImage = GetDisk(Drive);
355 if (!DiskImage || !IsDiskPresent(DiskImage))
356 {
357 DPRINT1("BiosDiskService(0x08): Disk number 0x%02X invalid\n", Drive);
358
359 /* Return error */
360 setAH(0x01);
362 break;
363 }
364
365 // Minus 2 because it's the maximum cylinder number (not count),
366 // and the last cylinder is reserved (for compatibility with BIOSes
367 // which reserve it for testing purposes).
368 MaxCylinders = DiskImage->DiskInfo.Cylinders - 2;
369 // Minus 1 because it's the maximum head number (not count).
370 MaxHeads = DiskImage->DiskInfo.Heads - 1;
371
372 // CL: Sector number 1-63 (bits 0-5)
373 // High two bits of cylinder (bits 6-7, hard disk only)
374 setCL((DiskImage->DiskInfo.Sectors & 0x3F) |
375 ((HIBYTE(MaxCylinders) & 0x02) << 6));
376 // CH: Low eight bits of cylinder number
377 setCH(LOBYTE(MaxCylinders));
378
379 setDH(MaxHeads);
380
381 if (Drive & 0x80)
382 {
383 /* Count the number of active HDDs */
384 for (i = 0; i < ARRAYSIZE(HardDrive); ++i)
385 {
387 ++PresentDrives;
388 }
389
390 /* Reset ES:DI to NULL */
391 // FIXME: NONONO!! Apps expect (for example, MS-DOS kernel)
392 // that this function does not modify ES:DI if it was called
393 // for a HDD.
394 // setES(0x0000);
395 // setDI(0x0000);
396 }
397 else
398 {
399 /* Count the number of active floppies */
400 for (i = 0; i < ARRAYSIZE(FloppyDrive); ++i)
401 {
403 ++PresentDrives;
404 }
405
406 /* ES:DI points to the floppy parameter table */
407 setES(HIWORD(((PULONG)BaseAddress)[0x1E]));
408 setDI(LOWORD(((PULONG)BaseAddress)[0x1E]));
409 }
410 setDL(PresentDrives);
411
412 setBL(DiskImage->DiskType); // DiskGeometryList[DiskImage->DiskType].biosval
413 setAL(0x00);
414
415 /* Return success */
416 setAH(0x00);
417 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
418 break;
419 }
420
421 /* Hard Disk -- Initialize Controller with Drive Parameters */
422 case 0x09:
423
424 /* Hard Disk -- Read Long Sectors */
425 case 0x0A:
426
427 /* Hard Disk -- Write Long Sectors */
428 case 0x0B:
429 goto Default;
430
431 /* Hard Disk -- Seek to Cylinder */
432 case 0x0C:
433 {
434 BYTE Status;
435 BYTE Head = getDH();
436
437 // CH: Low eight bits of cylinder number
438 // CL: High two bits of cylinder (bits 6-7, hard disk only)
439 WORD Cylinder = MAKEWORD(getCH(), (getCL() >> 6) & 0x02);
440
441 // CL: Sector number 1-63 (bits 0-5)
442 BYTE Sector = (getCL() & 0x3F); // 1-based
443
444 Drive = getDL();
445 if (!(Drive & 0x80))
446 {
447 DPRINT1("BiosDiskService(0x0C): Disk number 0x%02X is not a HDD\n", Drive);
448
449 /* Return error */
450 setAH(0x01);
452 break;
453 }
454
455 DiskImage = GetDisk(Drive);
456 if (!DiskImage || !IsDiskPresent(DiskImage))
457 {
458 DPRINT1("BiosDiskService(0x0C): Disk number 0x%02X invalid\n", Drive);
459
460 /* Return error */
461 setAH(0x01);
463 break;
464 }
465
466 /* Set position */
467 Status = SeekDisk(DiskImage, Cylinder, Head, Sector);
468 if (Status == 0x00)
469 {
470 /* Return success */
471 setAH(0x00);
472 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
473 }
474 else
475 {
476 DPRINT1("BiosDiskService(0x0C): Error when seeking in disk number 0x%02X (0x%02X)\n", Drive, Status);
477
478 /* Return error */
479 setAH(Status);
481 }
482
483 break;
484 }
485
486 /* Hard Disk -- Reset Hard Disks */
487 case 0x0D:
488 {
489 // FIXME: Should do what 0x11 does.
491 }
492
493 /* Hard Disk -- Read Sector Buffer (XT only) */
494 case 0x0E:
495
496 /* Hard Disk -- Write Sector Buffer (XT only) */
497 case 0x0F:
498 goto Default;
499
500 /* Hard Disk -- Check if Drive is ready */
501 case 0x10:
502 {
503 Drive = getDL();
504 if (!(Drive & 0x80))
505 {
506 DPRINT1("BiosDiskService(0x10): Disk number 0x%02X is not a HDD\n", Drive);
507
508 /* Return error */
509 setAH(0x01);
511 break;
512 }
513
514 DiskImage = GetDisk(Drive);
515 if (!DiskImage || !IsDiskPresent(DiskImage))
516 {
517 DPRINT1("BiosDiskService(0x10): Disk number 0x%02X invalid\n", Drive);
518
519 /* Return error */
520 setAH(0x01);
522 break;
523 }
524
525 /* Return success */
526 setAH(0x00);
527 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
528 break;
529 }
530
531 /* Hard Disk -- Recalibrate Drive */
532 case 0x11:
533 {
534 BYTE Status;
535
536 Drive = getDL();
537 if (!(Drive & 0x80))
538 {
539 DPRINT1("BiosDiskService(0x11): Disk number 0x%02X is not a HDD\n", Drive);
540
541 /* Return error */
542 setAH(0x01);
544 break;
545 }
546
547 DiskImage = GetDisk(Drive);
548 if (!DiskImage || !IsDiskPresent(DiskImage))
549 {
550 DPRINT1("BiosDiskService(0x11): Disk number 0x%02X invalid\n", Drive);
551
552 /* Return error */
553 setAH(0x01);
555 break;
556 }
557
558 /* Set position to zero */
559 Status = SeekDisk(DiskImage, /*Cylinder*/ 0, /*Head*/ 0, /*Sector*/ 1);
560 if (Status == 0x00)
561 {
562 /* Return success */
563 setAH(0x00);
564 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
565 }
566 else
567 {
568 DPRINT1("BiosDiskService(0x11): Error when recalibrating disk number 0x%02X (0x%02X)\n", Drive, Status);
569
570 /* Return error */
571 setAH(Status);
573 }
574
575 break;
576 }
577
578 /* Hard Disk -- Controller RAM Diagnostic */
579 case 0x12:
580
581 /* Hard Disk -- Drive Diagnostic */
582 case 0x13:
583
584 /* Hard Disk -- Controller Internal Diagnostic */
585 case 0x14:
586 goto Default;
587
588 /* Disk -- Get Disk Type */
589 case 0x15:
590 {
591 Drive = getDL();
592 DiskImage = GetDisk(Drive);
593 if (!DiskImage || !IsDiskPresent(DiskImage))
594 {
595 DPRINT1("BiosDiskService(0x15): Disk number 0x%02X invalid\n", Drive);
596
597 /* Return error */
598 setAH(0x01);
600 break;
601 }
602
603 if (Drive & 0x80)
604 {
605 ULONG NumSectors;
606
607 /* Hard disk */
608 setAH(0x03);
609
610 /* Number of 512-byte sectors in CX:DX */
611 NumSectors = (ULONG)((ULONG)DiskImage->DiskInfo.Cylinders * DiskImage->DiskInfo.Heads)
612 * DiskImage->DiskInfo.Sectors;
613 setCX(HIWORD(NumSectors));
614 setDX(LOWORD(NumSectors));
615 }
616 else
617 {
618 /* Floppy */
619 setAH(0x01);
620 }
621
622 /* Return success */
623 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
624 break;
625 }
626
627 /* Floppy Disk -- Detect Disk Change */
628 case 0x16:
629
630 /* Floppy Disk -- Set Disk Type for Format */
631 case 0x17:
632
633 /* Disk -- Set Media Type for Format */
634 case 0x18:
635 goto Default;
636
637 default: Default:
638 {
639 DPRINT1("BIOS Function INT 13h, AH = 0x%02X, AL = 0x%02X, BH = 0x%02X NOT IMPLEMENTED\n",
640 getAH(), getAL(), getBH());
641 }
642 }
643}
PWCHAR Drive
Definition: chkdsk.c:73
#define UNIMPLEMENTED
Definition: debug.h:115
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static VOID AllDisksReset(VOID)
Definition: dskbios32.c:157
static PDISK_IMAGE GetDisk(IN BYTE DiskNumber)
Definition: dskbios32.c:130
static PDISK_IMAGE HardDrive[4]
Definition: dskbios32.c:37
static PDISK_IMAGE FloppyDrive[2]
Definition: dskbios32.c:36
unsigned short WORD
Definition: ntddk_ex.h:93
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
@ Default
Definition: stdole2.idl:392
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
BYTE LastDiskOperation
Definition: bios.h:81
BYTE LastDisketteOperation
Definition: bios.h:57
DISK_INFO DiskInfo
Definition: disk.h:30
BYTE DiskType
Definition: disk.h:31
BYTE LastOperationStatus
Definition: disk.h:33
BYTE Sectors
Definition: disk.h:23
BYTE Heads
Definition: disk.h:22
WORD Cylinders
Definition: disk.h:21
BYTE ReadDisk(IN PDISK_IMAGE DiskImage, IN WORD Cylinder, IN BYTE Head, IN BYTE Sector, IN BYTE NumSectors)
Definition: disk.c:359
BOOLEAN IsDiskPresent(IN PDISK_IMAGE DiskImage)
Definition: disk.c:321
BYTE WriteDisk(IN PDISK_IMAGE DiskImage, IN WORD Cylinder, IN BYTE Head, IN BYTE Sector, IN BYTE NumSectors)
Definition: disk.c:413
BYTE SeekDisk(IN PDISK_IMAGE DiskImage, IN WORD Cylinder, IN BYTE Head, IN BYTE Sector)
Definition: disk.c:328
uint32_t * PULONG
Definition: typedefs.h:59
#define MAKEWORD(a, b)
Definition: typedefs.h:248
uint32_t ULONG
Definition: typedefs.h:59
UCHAR WINAPI getBH(VOID)
Definition: registers.c:184
UCHAR WINAPI getCH(VOID)
Definition: registers.c:242
UCHAR WINAPI getAL(VOID)
Definition: registers.c:142
UCHAR WINAPI getCL(VOID)
Definition: registers.c:256
UCHAR WINAPI getDL(VOID)
Definition: registers.c:314
VOID WINAPI setDI(USHORT)
Definition: registers.c:441
UCHAR WINAPI getDH(VOID)
Definition: registers.c:300

Referenced by BiosBootstrapLoader(), and DiskBios32Post().

◆ BiosEquipmentService()

VOID WINAPI BiosEquipmentService ( LPWORD  Stack)

Definition at line 200 of file bios32.c.

201{
202 /* Return the equipment list */
204}
WORD EquipmentList
Definition: bios.h:45

Referenced by BiosInitialize(), and InitializeBiosInt32().

◆ BiosException()

static VOID WINAPI BiosException ( LPWORD  Stack)
static

Definition at line 193 of file bios32.c.

194{
195 /* Get the exception number and call the emulator API */
196 BYTE ExceptionNumber = LOBYTE(Stack[STACK_INT_NUM]);
197 EmulatorException(ExceptionNumber, Stack);
198}
VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack)
Definition: emulator.c:85
#define STACK_INT_NUM
Definition: int32.h:30

Referenced by InitializeBiosInt32().

◆ BiosGetMemorySize()

VOID WINAPI BiosGetMemorySize ( LPWORD  Stack)

Definition at line 206 of file bios32.c.

207{
208 /* Return the conventional memory size in kB, typically 640 kB */
210}
WORD MemorySize
Definition: bios.h:47

Referenced by BiosInitialize(), and InitializeBiosInt32().

◆ BiosHandleMasterPicIRQ()

static VOID WINAPI BiosHandleMasterPicIRQ ( LPWORD  Stack)
static

Definition at line 834 of file bios32.c.

835{
836 BYTE IrqNumber;
837
839 IrqNumber = IOReadB(PIC_MASTER_CMD);
840
841 DPRINT("Master - IrqNumber = 0x%02X\n", IrqNumber);
842
844}
VOID PicIRQComplete(BYTE IntNum)
Definition: bios32.c:816
#define PIC_OCW3_READ_ISR
Definition: pic.h:31

Referenced by InitializeBiosInt32().

◆ BiosHandleSlavePicIRQ()

static VOID WINAPI BiosHandleSlavePicIRQ ( LPWORD  Stack)
static

Definition at line 846 of file bios32.c.

847{
848 BYTE IrqNumber;
849
851 IrqNumber = IOReadB(PIC_SLAVE_CMD);
852
853 DPRINT("Slave - IrqNumber = 0x%02X\n", IrqNumber);
854
856}

Referenced by InitializeBiosInt32().

◆ BiosHwSetup()

static VOID BiosHwSetup ( VOID  )
static

Definition at line 897 of file bios32.c.

898{
899 /* Initialize the master and the slave PICs (cascade mode) */
902
903 /*
904 * Set the interrupt vector offsets for each PIC
905 * (base IRQs: 0x08-0x0F for IRQ 0-7, 0x70-0x77 for IRQ 8-15)
906 */
909
910 /* Tell the master PIC that there is a slave PIC at IRQ 2 */
911 IOWriteB(PIC_MASTER_DATA, 1 << 2);
912 /* Tell the slave PIC its cascade identity */
914
915 /* Make sure both PICs are in 8086 mode */
918
919 /* Clear the masks for both PICs */
920 // IOWriteB(PIC_MASTER_DATA, 0x00);
921 // IOWriteB(PIC_SLAVE_DATA , 0x00);
922 /* Disable all IRQs */
924 IOWriteB(PIC_SLAVE_DATA , 0xFF);
925
926
927 /* Initialize PIT Counter 0 - Mode 2, 16bit binary count */
928 // NOTE: Some BIOSes set it to Mode 3 instead.
930 // 18.2Hz refresh rate
931 IOWriteB(PIT_DATA_PORT(0), 0x00);
932 IOWriteB(PIT_DATA_PORT(0), 0x00);
933
934 /* Initialize PIT Counter 1 - Mode 2, 8bit binary count */
936 // DRAM refresh every 15ms: http://www.cs.dartmouth.edu/~spl/Academic/Organization/docs/PC%20Timer%208253.html
937 IOWriteB(PIT_DATA_PORT(1), 18);
938
939 /* Initialize PIT Counter 2 - Mode 3, 16bit binary count */
941 // Count for 440Hz
942 IOWriteB(PIT_DATA_PORT(2), 0x97);
943 IOWriteB(PIT_DATA_PORT(2), 0x0A);
944
945
946 /* Initialize PS/2 keyboard port */
947 // Enable the port
949 // Port interrupts and clock enabled,
950 // enable keyboard scancode translation.
951 // POST passed, force keyboard unlocking.
953 IOWriteB(PS2_DATA_PORT , 0x6D);
954 // Enable data reporting
955 IOWriteB(PS2_DATA_PORT , 0xF4);
956
958}
static VOID WINAPI BiosTimerIrq(LPWORD Stack)
Definition: bios32.c:859
VOID EnableHwIRQ(UCHAR hwirq, EMULATOR_INT32_PROC func)
Definition: bios32.c:802
#define BIOS_PIC_SLAVE_INT
Definition: bios32p.h:21
#define BIOS_PIC_MASTER_INT
Definition: bios32p.h:20
#define PS2_CONTROL_PORT
Definition: ps2.h:17
#define PIC_ICW4_8086
Definition: pic.h:23
#define PIC_SLAVE_DATA
Definition: pic.h:18
#define PIC_ICW1_ICW4
Definition: pic.h:21
#define PIC_MASTER_DATA
Definition: pic.h:16
#define PIC_ICW1
Definition: pic.h:20
#define PIT_DATA_PORT(x)
Definition: pit.h:18
#define PIT_COMMAND_PORT
Definition: pit.h:19

Referenced by Bios32Post().

◆ BiosMiscService()

static VOID WINAPI BiosMiscService ( LPWORD  Stack)
static

Definition at line 212 of file bios32.c.

213{
214 switch (getAH())
215 {
216 /* OS Hooks for Multitasking */
217 case 0x80: // Device Open
218 case 0x81: // Device Close
219 case 0x82: // Program Termination
220 case 0x90: // Device Busy
221 case 0x91: // Device POST
222 {
223 /* Return success by default */
224 setAH(0x00);
225 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
226 break;
227 }
228
229 /* Wait on External Event */
230 case 0x41:
231 {
232 BYTE Value;
233 BOOLEAN Return;
234 static DWORD StartingCount;
235
236 /* Check if this is the first time this BOP occurred */
237 if (!getCF())
238 {
239 /* Set the starting count */
240 StartingCount = Bda->TickCounter;
241 }
242
243 if (getBL() != 0 && (Bda->TickCounter - StartingCount) >= getBL())
244 {
245 /* Timeout expired */
246 setCF(0);
247 break;
248 }
249
250 if (getAL() & (1 << 4))
251 {
252 /* Read from the I/O port */
253 Value = IOReadB(getDX());
254 }
255 else
256 {
257 /* Read from the memory */
259 }
260
261 switch (getAL() & 7)
262 {
263 /* Any external event */
264 case 0:
265 {
266 /* Return if this is not the first time the BOP occurred */
267 Return = getCF();
268 break;
269 }
270
271 /* Compare and return if equal */
272 case 1:
273 {
274 Return = Value == getBH();
275 break;
276 }
277
278 /* Compare and return if not equal */
279 case 2:
280 {
281 Return = Value != getBH();
282 break;
283 }
284
285 /* Test and return if not zero */
286 case 3:
287 {
288 Return = (Value & getBH()) != 0;
289 break;
290 }
291
292 /* Test and return if zero */
293 case 4:
294 {
295 Return = (Value & getBH()) == 0;
296 break;
297 }
298
299 default:
300 {
301 DPRINT1("INT 15h, AH = 41h - Unknown condition type: %u\n", getAL() & 7);
302 Return = TRUE;
303 break;
304 }
305 }
306
307 /* Repeat the BOP if we shouldn't return */
308 setCF(!Return);
309 break;
310 }
311
312 /* Keyboard intercept */
313 case 0x4F:
314 {
315 /* CF should be set but let's just set it again just in case */
316 /* Do not modify AL (the hardware scan code), but set CF to continue processing */
317 // setCF(1);
319 break;
320 }
321
322 /* Wait */
323 case 0x86:
324 {
325 /*
326 * Interval in microseconds in CX:DX
327 * See Ralf Brown: http://www.ctyme.com/intr/rb-1525.htm
328 * for more information.
329 */
330
331 static ULONG CompletionTime = 0;
332
333 /* Check if we're already looping */
334 if (getCF())
335 {
336 if (GetTickCount() >= CompletionTime)
337 {
338 /* Stop looping */
339 setCF(0);
340
341 /* Clear the CF on the stack too */
342 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
343 }
344 }
345 else
346 {
347 /* Set the CF on the stack */
349
350 /* Set the completion time and start looping */
351 CompletionTime = GetTickCount() + (MAKELONG(getDX(), getCX()) / 1000);
352 setCF(1);
353 }
354
355 break;
356 }
357
358 /* Copy Extended Memory */
359 case 0x87:
360 {
361 DWORD Count = (DWORD)getCX() * 2;
362 PFAST486_GDT_ENTRY Gdt = (PFAST486_GDT_ENTRY)SEG_OFF_TO_PTR(getES(), getSI());
363 DWORD SourceBase = Gdt[2].Base + (Gdt[2].BaseMid << 16) + (Gdt[2].BaseHigh << 24);
364 DWORD SourceLimit = Gdt[2].Limit + (Gdt[2].LimitHigh << 16);
365 DWORD DestBase = Gdt[3].Base + (Gdt[3].BaseMid << 16) + (Gdt[3].BaseHigh << 24);
366 DWORD DestLimit = Gdt[3].Limit + (Gdt[3].LimitHigh << 16);
367
368 /* Check for flags */
369 if (Gdt[2].Granularity) SourceLimit = (SourceLimit << 12) | 0xFFF;
370 if (Gdt[3].Granularity) DestLimit = (DestLimit << 12) | 0xFFF;
371
372 if ((Count > SourceLimit) || (Count > DestLimit))
373 {
374 setAX(0x80);
376 break;
377 }
378
379 /* Copy */
381 (PVOID)((ULONG_PTR)BaseAddress + SourceBase),
382 Count);
383
385 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
386 break;
387 }
388
389 /* Get Extended Memory Size */
390 case 0x88:
391 {
392 UCHAR Low, High;
393
394 /*
395 * Return the (usable) extended memory (after 1 MB)
396 * size in kB from CMOS.
397 */
403
404 /* Clear CF */
405 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
406 break;
407 }
408
409 /* Switch to Protected Mode */
410 case 0x89:
411 {
412 DPRINT1("BIOS INT 15h, AH=89h \"Switch to Protected Mode\" is UNIMPLEMENTED");
413
415 goto Default;
416 }
417
418 /* Get Configuration */
419 case 0xC0:
420 {
421 /* Return the BIOS ROM Configuration Table address in ES:BX */
422 // The BCT is found at F000:E6F5 for 100% compatible BIOSes.
424 setBX(0xE6F5);
425
426 /* Call successful; clear CF */
427 setAH(0x00);
428 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
429 break;
430 }
431
432 /* Return Extended-Bios Data-Area Segment Address (PS) */
433 case 0xC1:
434 {
435 /* We do not support EBDA yet */
438 goto Default;
439 }
440
441 /* Pointing Device BIOS Interface (PS) */
442 case 0xC2:
443 {
444 // FIXME: Reenable this call when we understand why
445 // our included mouse driver doesn't correctly reenable
446 // mouse reporting!
447 // BiosMousePs2Interface(Stack);
448 // break;
449 goto Default;
450 }
451
452 /* Get CPU Type and Mask Revision */
453 case 0xC9:
454 {
455 /*
456 * We can see this function as a CPUID replacement.
457 * See Ralf Brown: http://www.ctyme.com/intr/rb-1613.htm
458 * for more information.
459 */
460
461 /*
462 * Fast486 is a 486DX with FPU included,
463 * but old enough to not support CPUID.
464 */
465 setCX(0x0400);
466
467 /* Call successful; clear CF */
468 setAH(0x00);
469 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
470 break;
471 }
472
473 /* Get System Memory Map */
474 case 0xE8:
475 {
476 if (getAL() == 0x01)
477 {
478 /* The amount of memory between 1M and 16M, in kilobytes */
479 ULONG Above1M = (min(MAX_ADDRESS, 0x01000000) - 0x00100000) >> 10;
480
481 /* The amount of memory above 16M, in 64K blocks */
482 ULONG Above16M = (MAX_ADDRESS > 0x01000000) ? ((MAX_ADDRESS - 0x01000000) >> 16) : 0;
483
484 setAX(Above1M);
485 setBX(Above16M);
486 setCX(Above1M);
487 setDX(Above16M);
488
489 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
490 }
491 else if (getAL() == 0x20 && getEDX() == 'SMAP')
492 {
493 ULONG Offset = getEBX();
496 BOOLEAN Hooked;
498
499 /* Assume the buffer won't be large enough */
500 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
501
502 while (BytesWritten < getECX() && (ULONG_PTR)Map < (MAX_ADDRESS - sizeof(BIOS_MEMORY_MAP)))
503 {
504 /* Let's ask our memory controller */
505 if (!MemQueryMemoryZone(Offset, &Length, &Hooked))
506 {
507 /* No more memory blocks */
509 break;
510 }
511
513 Map->Length = (ULONGLONG)Length;
515
516 /* Go to the next record */
517 Map++;
518 Offset += Length;
519 BytesWritten += sizeof(BIOS_MEMORY_MAP);
520 }
521
522 setEAX('SMAP');
523 setEBX(Offset);
525 }
526 else
527 {
528 DPRINT1("BIOS Function INT 15h, AH = 0xE8 - unexpected AL = %02X, EDX = %08X\n",
529 getAL(), getEDX());
530 }
531
532 break;
533 }
534
535 default: Default:
536 {
537 DPRINT1("BIOS Function INT 15h, AH = 0x%02X NOT IMPLEMENTED\n",
538 getAH());
539
540 /*
541 * The original signification of the error code 0x86 is that
542 * no PC Cassette is present. The CF is also set in this case.
543 * To keep backward compatibility, newer BIOSes use this value
544 * to indicate an unimplemented call in INT 15h.
545 */
546 setAH(0x86);
548 }
549 }
550}
#define MAX_ADDRESS
@ BIOS_MEMORY_RESERVED
Definition: bios32.h:21
@ BIOS_MEMORY_AVAILABLE
Definition: bios32.h:20
@ CMOS_REG_ACTUAL_EXT_MEMORY_LOW
Definition: cmos.h:74
@ CMOS_REG_ACTUAL_EXT_MEMORY_HIGH
Definition: cmos.h:75
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
#define ULONG_PTR
Definition: config.h:101
unsigned long DWORD
Definition: ntddk_ex.h:95
#define min(a, b)
Definition: monoChain.cc:55
int Count
Definition: noreturn.cpp:7
#define DWORD
Definition: nt_native.h:44
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
struct BIOS_MEMORY_MAP * PBIOS_MEMORY_MAP
@ High
Definition: strmini.h:378
@ Low
Definition: strmini.h:380
DWORD TickCounter
Definition: bios.h:77
LONGLONG BaseAddress
Definition: osloader.h:33
LONGLONG Length
Definition: osloader.h:34
BOOLEAN MemQueryMemoryZone(ULONG StartAddress, PULONG Length, PBOOLEAN Hooked)
Definition: memory.c:381
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint64_t ULONGLONG
Definition: typedefs.h:67
ULONG WINAPI getEBX(VOID)
Definition: registers.c:156
ULONG WINAPI getCF(VOID)
Definition: registers.c:566
VOID WINAPI setCF(ULONG)
Definition: registers.c:573
VOID WINAPI setECX(ULONG)
Definition: registers.c:221
USHORT WINAPI getSI(VOID)
Definition: registers.c:404
ULONG WINAPI getEDX(VOID)
Definition: registers.c:272
ULONG WINAPI getECX(VOID)
Definition: registers.c:214
USHORT WINAPI getDI(VOID)
Definition: registers.c:434
VOID WINAPI setEBX(ULONG)
Definition: registers.c:163
UCHAR WINAPI getBL(VOID)
Definition: registers.c:198
VOID WINAPI setEAX(ULONG)
Definition: registers.c:107
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:960
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by InitializeBiosInt32().

◆ BiosRomBasic()

static VOID WINAPI BiosRomBasic ( LPWORD  Stack)
static

Definition at line 552 of file bios32.c.

553{
554 PrintMessageAnsi(BiosCharPrint, "FATAL: INT18: BOOT FAILURE.");
555
556 /* ROM Basic is unsupported, display a message to the user */
557 DisplayMessage(L"NTVDM doesn't support ROM Basic. The VDM is closing.");
558
559 /* Stop the VDM */
561}
static VOID BiosCharPrint(CHAR Character)
Definition: bios32.c:168
VOID PrintMessageAnsi(IN CHAR_PRINT CharPrint, IN LPCSTR Format,...)
Definition: ntvdm.c:416

Referenced by InitializeBiosInt32().

◆ BiosSystemTimerInterrupt()

static VOID WINAPI BiosSystemTimerInterrupt ( LPWORD  Stack)
static

Definition at line 786 of file bios32.c.

787{
788 /* Increase the system tick count */
789 Bda->TickCounter++;
790}

Referenced by InitializeBiosInt32().

◆ BiosTimerIrq()

static VOID WINAPI BiosTimerIrq ( LPWORD  Stack)
static

Definition at line 859 of file bios32.c.

860{
861 /*
862 * Perform the system timer interrupt.
863 *
864 * Do not call directly BiosSystemTimerInterrupt(Stack);
865 * because some programs may hook only BIOS_SYS_TIMER_INTERRUPT
866 * for their purpose...
867 */
868
869 WORD AX = getAX();
870 WORD CX = getCX();
871 WORD DX = getDX();
872 WORD BX = getBX();
873 WORD BP = getBP();
874 WORD SI = getSI();
875 WORD DI = getDI();
876 WORD DS = getDS();
877 WORD ES = getES();
878
880
881 setAX(AX);
882 setCX(CX);
883 setDX(DX);
884 setBX(BX);
885 setBP(BP);
886 setSI(SI);
887 setDI(DI);
888 setDS(DS);
889 setES(ES);
890 setCF(0);
891
892 // BiosSystemTimerInterrupt(Stack);
894}
@ DS
Definition: amd64_sup.c:16
#define BIOS_SYS_TIMER_INTERRUPT
Definition: bios32p.h:29
USHORT WINAPI getDS(VOID)
Definition: registers.c:508
USHORT WINAPI getBP(VOID)
Definition: registers.c:374
VOID WINAPI setBP(USHORT)
Definition: registers.c:381
VOID WINAPI setSI(USHORT)
Definition: registers.c:411

Referenced by BiosHwSetup().

◆ BiosTimeService()

static VOID WINAPI BiosTimeService ( LPWORD  Stack)
static

Definition at line 690 of file bios32.c.

691{
692 switch (getAH())
693 {
694 /* Get System Time */
695 case 0x00:
696 {
697 /* Set AL to 1 if midnight had passed, 0 otherwise */
698 setAL(Bda->MidnightPassed ? 0x01 : 0x00);
699
700 /* Return the tick count in CX:DX */
703
704 /* Reset the midnight flag */
706
707 break;
708 }
709
710 /* Set System Time */
711 case 0x01:
712 {
713 /* Set the tick count to CX:DX */
715
716 /* Reset the midnight flag */
718
719 break;
720 }
721
722 /* Get Real-Time Clock Time */
723 case 0x02:
724 {
725 UCHAR StatusB;
726
729
732
735
736 /* Daylight Savings Time */
738 StatusB = IOReadB(CMOS_DATA_PORT);
739 setDL(StatusB & 0x01);
740
741 /* Clear CF */
742 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
743 break;
744 }
745
746 // /* Set Real-Time Clock Time */
747 // case 0x03:
748 // {
749 // break;
750 // }
751
752 /* Get Real-Time Clock Date */
753 case 0x04:
754 {
757
760
763
766
767 /* Clear CF */
768 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
769 break;
770 }
771
772 // /* Set Real-Time Clock Date */
773 // case 0x05:
774 // {
775 // break;
776 // }
777
778 default:
779 {
780 DPRINT1("BIOS Function INT 1Ah, AH = 0x%02X NOT IMPLEMENTED\n",
781 getAH());
782 }
783 }
784}
@ CMOS_REG_DAY
Definition: cmos.h:59
@ CMOS_REG_STATUS_B
Definition: cmos.h:63
@ CMOS_REG_MONTH
Definition: cmos.h:60
@ CMOS_REG_MINUTES
Definition: cmos.h:54
@ CMOS_REG_YEAR
Definition: cmos.h:61
@ CMOS_REG_SECONDS
Definition: cmos.h:52
@ CMOS_REG_HOURS
Definition: cmos.h:56
@ CMOS_REG_CENTURY
Definition: cmos.h:76
BYTE MidnightPassed
Definition: bios.h:78

Referenced by InitializeBiosInt32().

◆ C_ASSERT() [1/2]

C_ASSERT ( sizeof(BiosCopyright) -1<=  0x5B)

◆ C_ASSERT() [2/2]

C_ASSERT ( sizeof(BiosDate) -  1 = =0x08)

◆ DosBootsectorInitialize()

VOID DosBootsectorInitialize ( VOID  )

Definition at line 1089 of file dem.c.

1090{
1091 /* We write the bootsector at 0000:7C00 */
1092 ULONG_PTR StartAddress = (ULONG_PTR)SEG_OFF_TO_PTR(0x0000, 0x7C00);
1093 ULONG_PTR Address = StartAddress;
1094 CHAR DosKernelFileName[] = ""; // No DOS BIOS file name, therefore we will load DOS32
1095
1096 DPRINT("DosBootsectorInitialize\n");
1097
1098 /* Write the "bootsector" */
1100 Address += sizeof(Bootsector1);
1101 RtlCopyMemory((PVOID)Address, DosKernelFileName, sizeof(DosKernelFileName));
1102 Address += sizeof(DosKernelFileName);
1104 Address += sizeof(Bootsector2);
1105
1106 /* Initialize the callback context */
1108 (ULONG_PTR)MEM_ALIGN_UP(0x7C00 + Address - StartAddress, sizeof(WORD)));
1109
1110 /* Register the DOS Loading BOP */
1112}
static VOID WINAPI DosInitialize(LPWORD Stack)
Definition: dem.c:1129
static BYTE Bootsector2[]
Definition: dem.c:1082
static BYTE Bootsector1[]
Definition: dem.c:1076
#define BOP_LOAD_DOS
Definition: dem.h:24
CALLBACK16 DosContext
Definition: dos.c:40
#define MEM_ALIGN_UP(ptr, align)
Definition: emulator.h:24
static WCHAR Address[46]
Definition: ping.c:68
VOID InitializeContext(IN PCALLBACK16 Context, IN USHORT Segment, IN USHORT Offset)
Definition: callback.c:60
char CHAR
Definition: xmlstorage.h:175

Referenced by BiosBootstrapLoader().

◆ EnableHwIRQ()

VOID EnableHwIRQ ( UCHAR  hwirq,
EMULATOR_INT32_PROC  func 
)

Definition at line 802 of file bios32.c.

803{
805
806 PicSetIRQMask(1 << hwirq, 0);
807 if (hwirq < 8)
808 vector = BIOS_PIC_MASTER_INT + hwirq;
809 else
810 vector = BIOS_PIC_SLAVE_INT + hwirq - 8;
811
813}
static VOID PicSetIRQMask(USHORT off, USHORT on)
Definition: bios32.c:794
#define RegisterBiosInt32(IntNumber, IntHandler)
Definition: bios32p.h:34
GLenum func
Definition: glext.h:6028

Referenced by BiosHwSetup(), KbdBios32Post(), and MouseBios32Post().

◆ InitializeBiosData()

static VOID InitializeBiosData ( VOID  )
static

Definition at line 1036 of file bios32.c.

1037{
1038 UCHAR Low, High;
1039
1040 /* Initialize the BDA contents */
1041 RtlZeroMemory(Bda, sizeof(*Bda));
1042
1043 /*
1044 * Retrieve the basic equipment list from the CMOS
1045 */
1048 // TODO: Update it if required.
1049 Bda->EquipmentList &= 0x00FF; // High byte cleared for now...
1050
1051 /*
1052 * Retrieve the conventional memory size
1053 * in kB from the CMOS, typically 640 kB.
1054 */
1060}
@ CMOS_REG_BASE_MEMORY_HIGH
Definition: cmos.h:70
@ CMOS_REG_BASE_MEMORY_LOW
Definition: cmos.h:69
@ CMOS_REG_EQUIPMENT_LIST
Definition: cmos.h:68

Referenced by Bios32Post().

◆ InitializeBiosInt32()

static VOID InitializeBiosInt32 ( VOID  )
static

Definition at line 960 of file bios32.c.

961{
962 USHORT i;
963
964 /* Initialize the callback context */
966
967 /* Register the default BIOS interrupt vectors */
968
969 /*
970 * Zero out all of the IVT (0x00 -- 0xFF). Some applications
971 * indeed expect to have free vectors at the end of the IVT.
972 */
973 RtlZeroMemory(BaseAddress, 0x0100 * sizeof(ULONG));
974
975#if defined(ADVANCED_DEBUGGING) && (ADVANCED_DEBUGGING_LEVEL >= 3)
976 // Initialize all the interrupt vectors to the default one.
977 for (i = 0x00; i <= 0xFF; i++)
979#endif
980
981 /* Initialize the exception interrupt vectors to a default Exception handler */
982 for (i = 0x00; i <= 0x07; i++)
984
985 /* Initialize HW interrupt vectors to a default HW handler */
986 for (i = BIOS_PIC_MASTER_INT; i < BIOS_PIC_MASTER_INT + 8; i++) // 0x08 -- 0x0F
988 for (i = BIOS_PIC_SLAVE_INT ; i < BIOS_PIC_SLAVE_INT + 8; i++) // 0x70 -- 0x77
990
991 /* Initialize software vector handlers */
992 // BIOS_VIDEO_INTERRUPT : 0x10 (vidbios32.c)
995 // BIOS_DISK_INTERRUPT : 0x13 (dskbios32.c)
996 // BIOS_SERIAL_INTERRUPT : 0x14 -- UNIMPLEMENTED
998 // BIOS_KBD_INTERRUPT : 0x16 (kbdbios32.c)
999 // BIOS_PRINTER_INTERRUPT: 0x17 -- UNIMPLEMENTED
1003 // BIOS_KBD_CTRL_BREAK_INTERRUPT: 0x1B -- UNIMPLEMENTED
1005
1006 /* Vectors that should be implemented (see above) */
1007 RegisterBiosInt32(0x14, NULL);
1008 RegisterBiosInt32(0x17, NULL);
1009 RegisterBiosInt32(0x1B, NULL);
1010 RegisterBiosInt32(0x4A, NULL); // User Alarm Handler
1011
1012 /* Relocated services by the BIOS (when needed) */
1013 RegisterBiosInt32(0x40, NULL); // ROM BIOS Diskette Handler relocated by Hard Disk BIOS
1014 RegisterBiosInt32(0x42, NULL); // Relocated Default INT 10h Video Services
1015
1016 /* Miscellaneous unimplemented vector handlers that should better have a default one */
1017 RegisterBiosInt32(0x4B, NULL); // Virtual DMA Specification Services
1018 RegisterBiosInt32(0x5C, NULL); // NetBIOS
1019
1020 // ROM-BASIC interrupts span from 0x80 up to 0xEF.
1021 // They don't have any default handler at the moment.
1022
1023 /* Some vectors are in fact addresses to tables */
1024 ((PULONG)BaseAddress)[0x1D] = NULL32; // Video Parameter Tables
1025 ((PULONG)BaseAddress)[0x1E] = NULL32; // Diskette Parameters
1026 ((PULONG)BaseAddress)[0x1F] = NULL32; // 8x8 Graphics Font
1027 ((PULONG)BaseAddress)[0x41] = NULL32; // Hard Disk 0 Parameter Table Address
1028 ((PULONG)BaseAddress)[0x43] = NULL32; // Character Table (EGA, MCGA, VGA)
1029 ((PULONG)BaseAddress)[0x46] = NULL32; // Hard Disk 1 Drive Parameter Table Address
1030 /* Tables that are always uninitialized */
1031 ((PULONG)BaseAddress)[0x44] = NULL32; // ROM BIOS Character Font, Characters 00h-7Fh (PCjr)
1032 ((PULONG)BaseAddress)[0x48] = NULL32; // Cordless Keyboard Translation (PCjr)
1033 ((PULONG)BaseAddress)[0x49] = NULL32; // Non-Keyboard Scan-code Translation Table (PCJr)
1034}
static VOID WINAPI BiosException(LPWORD Stack)
Definition: bios32.c:193
static VOID WINAPI BiosHandleSlavePicIRQ(LPWORD Stack)
Definition: bios32.c:846
static VOID WINAPI BiosSystemTimerInterrupt(LPWORD Stack)
Definition: bios32.c:786
static VOID WINAPI BiosBootstrapLoader(LPWORD Stack)
Definition: bios32.c:567
static VOID WINAPI BiosTimeService(LPWORD Stack)
Definition: bios32.c:690
static VOID WINAPI BiosMiscService(LPWORD Stack)
Definition: bios32.c:212
static VOID WINAPI BiosHandleMasterPicIRQ(LPWORD Stack)
Definition: bios32.c:834
static VOID WINAPI BiosRomBasic(LPWORD Stack)
Definition: bios32.c:552
VOID WINAPI BiosEquipmentService(LPWORD Stack)
Definition: bios32.c:200
VOID WINAPI BiosGetMemorySize(LPWORD Stack)
Definition: bios32.c:206
#define BIOS_EQUIPMENT_INTERRUPT
Definition: bios32p.h:23
#define BIOS_TIME_INTERRUPT
Definition: bios32p.h:28
#define BIOS_MEMORY_SIZE
Definition: bios32p.h:24
#define BIOS_MISC_INTERRUPT
Definition: bios32p.h:25
#define BIOS_BOOTSTRAP_LOADER
Definition: bios32p.h:27
#define BIOS_ROM_BASIC
Definition: bios32p.h:26
#define NULL
Definition: types.h:112
#define NULL32
Definition: emulator.h:21

Referenced by Bios32Post().

◆ PicIRQComplete()

VOID PicIRQComplete ( BYTE  IntNum)

Definition at line 816 of file bios32.c.

817{
818 /*
819 * If this was a PIC IRQ, send an End-of-Interrupt to the PIC.
820 */
821 if (IntNum >= BIOS_PIC_MASTER_INT && IntNum < BIOS_PIC_MASTER_INT + 8)
822 {
823 /* It was an IRQ from the master PIC */
825 }
826 else if (IntNum >= BIOS_PIC_SLAVE_INT && IntNum < BIOS_PIC_SLAVE_INT + 8)
827 {
828 /* It was an IRQ from the slave PIC */
831 }
832}

Referenced by BiosHandleMasterPicIRQ(), BiosHandleSlavePicIRQ(), BiosKeyboardIrq(), BiosMouseIrq(), BiosTimerIrq(), and DosMouseIrq().

◆ PicSetIRQMask()

static VOID PicSetIRQMask ( USHORT  off,
USHORT  on 
)
static

Definition at line 794 of file bios32.c.

795{
796 UCHAR pic1off = off, pic1on = on, pic2off = off>>8, pic2on = on>>8;
797 IOWriteB(PIC_MASTER_DATA, (IOReadB(PIC_MASTER_DATA) & ~pic1off) | pic1on);
798 IOWriteB(PIC_SLAVE_DATA , (IOReadB(PIC_SLAVE_DATA ) & ~pic2off) | pic2on);
799}

Referenced by EnableHwIRQ().

Variable Documentation

◆ BiosConfigTable

const BIOS_CONFIG_TABLE BiosConfigTable
static
Initial value:
=
{
sizeof(BIOS_CONFIG_TABLE) - sizeof(((BIOS_CONFIG_TABLE*)0)->Length),
{
0x78,
0x00,
0x10,
0x00,
0x00
}
}
#define BIOS_SUBMODEL
Definition: bios32.c:111
#define BIOS_REVISION
Definition: bios32.c:112
struct _BIOS_CONFIG_TABLE BIOS_CONFIG_TABLE

Definition at line 115 of file bios32.c.

Referenced by Bios32Initialize().

◆ BiosContext

◆ BiosCopyright

const CHAR BiosCopyright[] = "0000000 NTVDM IBM COMPATIBLE 486 BIOS COPYRIGHT (C) ReactOS Team 1996-"COPYRIGHT_YEAR
static

Definition at line 138 of file bios32.c.

Referenced by Bios32Initialize().

◆ BiosDate

const CHAR BiosDate[] = "06/17/13"
static

Definition at line 141 of file bios32.c.

Referenced by Bios32Initialize(), and CmpGetBiosDate().

◆ BiosVersion

const CHAR BiosVersion[]
static
Initial value:
= "ReactOS NTVDM 32-bit BIOS Version "KERNEL_VERSION_STR"\0"
"BIOS32 Version "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")"

Definition at line 139 of file bios32.c.

Referenced by Bios32Initialize(), CmpGetBiosVersion(), and CmpInitializeMachineDependentConfiguration().

◆ Bootstrap

const BYTE Bootstrap[]
static
Initial value:
=
{
0xEA,
0x5B, 0xE0, 0x00, 0xF0,
}

Definition at line 147 of file bios32.c.

Referenced by Bios32Initialize().

◆ PostCode

const BYTE PostCode[]
static
Initial value:

Definition at line 157 of file bios32.c.

Referenced by Bios32Initialize().