Author: aandrejevic Date: Sun Oct 27 19:08:58 2013 New Revision: 60773
URL: http://svn.reactos.org/svn/reactos?rev=60773&view=rev Log: [NTVDM] The PS/2 should latch the last value that was read in the case of multiple reads. Modify the BIOS keyboard IRQ handler to support hooks.
Modified: branches/ntvdm/subsystems/ntvdm/bios.c branches/ntvdm/subsystems/ntvdm/ps2.c
Modified: branches/ntvdm/subsystems/ntvdm/bios.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.c?re... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] Sun Oct 27 19:08:58 2013 @@ -1132,9 +1132,9 @@ { BYTE ScanCode, VirtualKey; WORD Character; - + /* Loop while there is a scancode available */ - while (KeyboardReadStatus() & 1) + do { /* Get the scan code and virtual key code */ ScanCode = KeyboardReadData(); @@ -1173,6 +1173,7 @@ BiosKeyboardMap[VirtualKey] &= ~(1 << 7); } } + while (KeyboardReadStatus() & 1);
/* Clear the keyboard flags */ Bda->KeybdShiftFlags = 0;
Modified: branches/ntvdm/subsystems/ntvdm/ps2.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ps2.c?rev... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/ps2.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ps2.c [iso-8859-1] Sun Oct 27 19:08:58 2013 @@ -20,7 +20,7 @@ static BOOLEAN KeyboardQueueEmpty = TRUE; static UINT KeyboardQueueStart = 0; static UINT KeyboardQueueEnd = 0; -static BYTE KeyboardResponse = 0; +static BYTE KeyboardData = 0, KeyboardResponse = 0; static BOOLEAN KeyboardReadResponse = FALSE, KeyboardWriteResponse = FALSE; static BYTE KeyboardConfig = PS2_DEFAULT_CONFIG;
@@ -190,19 +190,19 @@
BYTE KeyboardReadData() { - BYTE Value = 0; - /* If there was a response byte from the controller, return it */ if (KeyboardReadResponse) { KeyboardReadResponse = FALSE; - return KeyboardResponse; - } - - /* Otherwise, read the data from the queue */ - KeyboardQueuePop(&Value); - - return Value; + KeyboardData = KeyboardResponse; + } + else + { + /* Otherwise, read the data from the queue */ + KeyboardQueuePop(&KeyboardData); + } + + return KeyboardData; }
VOID KeyboardWriteData(BYTE Data)