d5669cee972b17c12a94c34dc120f55a83eabdd3
[reactos.git] / reactos / subsystems / ntvdm / hardware / keyboard.c
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: keyboard.c
5 * PURPOSE: Keyboard emulation
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #define NDEBUG
12
13 #include "keyboard.h"
14 #include "ps2.h"
15
16 static BYTE PS2Port = 0;
17
18 /* PUBLIC FUNCTIONS ***********************************************************/
19
20 VOID KeyboardEventHandler(PKEY_EVENT_RECORD KeyEvent)
21 {
22 WORD i;
23 BYTE ScanCode = (BYTE)KeyEvent->wVirtualScanCode;
24
25 /* If this is a key release, set the highest bit in the scan code */
26 if (!KeyEvent->bKeyDown) ScanCode |= 0x80;
27
28 /* Push the scan code into the PS/2 queue */
29 for (i = 0; i < KeyEvent->wRepeatCount; i++)
30 {
31 PS2QueuePush(PS2Port, ScanCode);
32 }
33
34 // PicInterruptRequest(1);
35 }
36
37 VOID KeyboardCommand(BYTE Command)
38 {
39 UNIMPLEMENTED;
40 }
41
42 BOOLEAN KeyboardInit(BYTE PS2Connector)
43 {
44 PS2Port = PS2Connector;
45 return TRUE;
46 }