2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
5 * PURPOSE: Keyboard emulation
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
9 /* INCLUDES *******************************************************************/
16 /* PRIVATE VARIABLES **********************************************************/
18 static BYTE PS2Port
= 0;
20 /* PRIVATE FUNCTIONS **********************************************************/
22 static VOID WINAPI
KeyboardCommand(LPVOID Param
, BYTE Command
)
27 /* PUBLIC FUNCTIONS ***********************************************************/
29 VOID
KeyboardEventHandler(PKEY_EVENT_RECORD KeyEvent
)
32 BYTE ScanCode
= (BYTE
)KeyEvent
->wVirtualScanCode
;
34 /* If this is a key release, set the highest bit in the scan code */
35 if (!KeyEvent
->bKeyDown
) ScanCode
|= 0x80;
37 /* Push the scan code into the PS/2 queue */
38 for (i
= 0; i
< KeyEvent
->wRepeatCount
; i
++)
40 PS2QueuePush(PS2Port
, ScanCode
);
43 // PicInterruptRequest(1);
46 BOOLEAN
KeyboardInit(BYTE PS2Connector
)
48 /* Finish to plug the mouse to the specified PS/2 port */
49 PS2Port
= PS2Connector
;
50 PS2SetDeviceCmdProc(PS2Port
, NULL
, KeyboardCommand
);