Keyboard_Event

mov     ah, UpDownFlag   ; 00h for down stroke, 80h for up stroke
mov     al, VirtualKey   ; Windows virtual-key code
mov     bh, PrefixFlag   ; 00h if no prefix, 1 if 0E0h prefix byte
mov     bl, ScanCode     ; hardware scan code

mov     si, word ptr [ExtraInfo]
mov     di, word ptr [ExtraInfo+2]  ; extra information

call    [Keyboard_Event]            ; keyboard-event function

Records a keystroke. The keystroke may subsequently be used to generate a WM_KEYUP or WM_KEYDOWN message. The keyboard driver's interrupt handler calls this function.

UpDownFlag
Key up or down flag. The parameter is 0x00h for a down stroke and 80h for an up stroke.
VirtualKey
Virtual-key code. The code must be a value in the range 1 to 254.
PrefixFlag
Flag that specifies whether the scan code was preceded by the 0E0h prefix byte. The parameter is 00h if there was no prefix byte, and is 1 if there was a prefix byte.
ScanCode
Hardware-scan code.
ExtraInfo
32-bit value associated with the key stroke.

Although the keyboard driver passes the hardware-scan code (which is OEM-dependent) to Windows, Windows does not use the code. Instead, Windows subsequently passes the scan code to the ToAscii function, which may use it for special purposes. The interrupt handler sets the up/down bit in the scan code to 0.

This interrupt handler may process some keystrokes without passing them to Windows through the keyboard-event callback function. In particular, the handler processes CTRL+ALT+SYSREQ keytrokes and generates a nonmaskable interrupt (NMI). Under certain circumstances, the driver's interrupt handler passes keystrokes to the original keyboard-interrupt handler. This is the case for CTRL+ALT+DELETE key combination and for the PAUSE key.

Use the PRINTSCREEN key to take a screen snapshot, which is saved in the Windows clipboard. This is handled in the interrupt routine by calling the event procedure with VK_SNAPSHOT in AL, with the value equal to 0 (for full-screen snapshot) or 1 (for active-window snapshot) in BL.

See Also

Enable, ToAscii