Interrupt 16h Keyboard I/O(0:0058h) access the keyboard
Function 00h Get Keyboard Input - read the next character in keyboard buffer,
if no key ready, wait for one.
entry AH 00h
return AH scan code
AL ASCII character
Function 01h Check Keystroke Buffer - Do Not Clear
entry AH 01h
return ZF 0 (clear) if character in buffer
1 (set) if no character in buffer
AH scan code of character (if ZF=0)
AL ASCII character if applicable
note Keystroke is not removed from buffer
Function 02h Shift Status - fetch bit flags indicating shift status
entry AH 02h
return AL bit codes (same as [0040:0017])
bit 7 Insert state
bit 6 CapsLock state
bit 5 NumLock state
bit 4 ScrollLock state
bit 3 Alt key
bit 2 Control key
bit 1 Left shift (left caps-shift key)
bit 0 Right shift (right caps-shift key)
note other codes found at [0040:0018]
bit 7 Insert shift (Ins key)
bit 6 Caps shift (CapsLock key)
bit 5 Num shift (NumLock key)
bit 4 Scroll shift (ScrollLock key)
bit 3 Hold state (Ctrl-NumLock is in effect)
Function 03h Keyboard - Set Repeat Rate (PCjr, AT, XT/286, PS/2)
entry AH 03h
AL 00h reset typematic (PCjr)
01h increase initial delay (PCjr)
02h increase continuing delay (PCjr)
03h increase both delays (PCjr)
04h turn off typematic (PCjr)
05h set typematic rate (AT, PS/2)
BH 00h-03h for delays of 250ms, 500ms, 750ms, or 1second
0,0 250ms
0,1 500ms
1,0 750ms
1,1 1 second
BL 00h-1Fh for typematic rates of 30cps down to 2cps
00000 30 01011 10.9 10101 4.5
00001 26.7 01100 10 10110 4.3
00010 24 01101 9.2 10111 4
00011 21.8 01110 8.6 11000 3.7
00100 20 01111 8 11001 3.3
00101 18.5 10000 7.5 11010 3
00110 17.1 10001 6.7 11011 2.7
00111 16 10010 6 11100 2.5
01000 15 10011 5.5 11101 2.3
01001 13.3 10011 5.5 11110 2.1
01010 12 10100 5 11111 2
Function 04h Keyboard Click Toggle (PCjr and Convertible)
entry AH 04h
AL 00h for click off
01h for click on
Function 05h Keyboard Buffer Write (AT or PS/2 with enhanced kbd)
(XT/286, PS/2, AT with "Enhanced" keyboard)
entry AH 05h
CH scan code
CL ASCII character
return AL 01h if buffer full
Function 10h Get Enhanced Keystroke And Read (F11, F12 Enhanced Keyb'd)
(XT/286, PS/2, AT with "Enhanced" keyboard)
entry AH 10h
return AH scan code
AL ASCII character if applicable
Function 11h Check Enhanced Keystroke (F11-F12 on enhanced keyboard)
(XT/286, PS/2, AT with "Enhanced" keyboard)
entry AH 11h
return ZF 0 (clear) if key pressed
1 if buffer empty
AH scan code (when ZF=0)
AL ASCII character if applicable (when ZF=0)
note Keystroke is not removed from buffer
Function 12h Extended Get Shift Status (F11, F12 Enhanced keyboard)
entry AH 12h
return AL bit
0 right Shift key depressed
1 left Shift key depressed
2 Control key depressed
3 Alt key depressed
4 ScrollLock state active
5 NumLock state active
6 CapsLock state active
7 insert state is active
AH 0 left Control key pressed
1 left Alt key depressed
2 right Control key pressed
3 right Alt key depressed
4 Scroll Lock key depressed
5 NumLock key depressed
6 CapsLock key depressed
7 SysReq key depressed
Function F0h Set CPU speed (Compaq 386)
entry AH F0h set speed
return unknown
note used by Compaq DOS MODE command.
parameters not availible