{
switch (getAH())
{
+ /* Keyboard intercept */
+ case 0x4F:
+ {
+ /* CF should be set but let's just set it again just in case */
+ /* Do not modify AL (the hardware scan code), but set CF to continue processing */
+ // setCF(1);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
+ break;
+ }
+
/* Wait */
case 0x86:
{
Bct->Model = BIOS_MODEL;
Bct->SubModel = BIOS_SUBMODEL;
Bct->Revision = BIOS_REVISION;
- Bct->Feature[0] = 0x64; // At the moment we don't support "INT 15/AH=4Fh called upon INT 09h" nor "wait for external event (INT 15/AH=41h) supported"; see http://www.ctyme.com/intr/rb-1594.htm#Table510
+ Bct->Feature[0] = 0x70; // At the moment we don't support "wait for external event (INT 15/AH=41h)", we also don't have any "extended BIOS area allocated (usually at top of RAM)"; see http://www.ctyme.com/intr/rb-1594.htm#Table510
Bct->Feature[1] = 0x00; // We don't support anything from here; see http://www.ctyme.com/intr/rb-1594.htm#Table511
Bct->Feature[2] = 0x00;
Bct->Feature[3] = 0x00;
BYTE ScanCode, VirtualKey;
WORD Character;
- /* Get the scan code and virtual key code */
- ScanCode = IOReadB(PS2_DATA_PORT);
+ /*
+ * Get the scan code from the PS/2 port, then call the
+ * INT 15h, AH=4Fh Keyboard Intercept function to try to
+ * translate the scan code. CF must be set before the call.
+ * In return, if CF is set we continue processing the scan code
+ * stored in AL, and if not, we skip it.
+ */
+ setCF(1);
+ setAL(IOReadB(PS2_DATA_PORT));
+ setAH(0x4F);
+ Int32Call(&BiosContext, BIOS_MISC_INTERRUPT);
+
+ /* Check whether CL is clear. If so, skip the scan code. */
+ if (getCF() == 0) goto Quit;
+ /**/setCF(0);/**/ // FIXME: HACK: Reset CF otherwise we enter in an infinite loop.
+
+ /* Retrieve the modified scan code in AL */
+ ScanCode = getAL();
+
+ /* Get the corresponding virtual key code */
VirtualKey = MapVirtualKey(ScanCode & 0x7F, MAPVK_VSC_TO_VK);
/* Check if this is a key press or release */
if (BiosKeyboardMap[VK_CAPITAL] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_CAPSLOCK;
if (BiosKeyboardMap[VK_INSERT] & (1 << 7)) Bda->KeybdShiftFlags |= BDA_KBDFLAG_INSERT;
+ DPRINT("BiosKeyboardIrq - Character = 0x%X, ScanCode = 0x%X, KeybdShiftFlags = 0x%X\n",
+ Character, ScanCode, Bda->KeybdShiftFlags);
+
+Quit:
PicIRQComplete(Stack);
}