Keyboards - Notes 2

The following is an excerpt about special keyboard scan codes.  The entire text can be found at http://www.jimprice.com/jim-asc.htm.


IBM PC Keyboard Scan Codes

For many of the special key combinations such as ALT-A, F1, PgUp, and so forth, the IBM PC uses a special two-character escape sequence. Depending on the programming language being used and the level at which the keyboard is being accessed, the escape character is either ESC (27, 0x1B), or NUL (0). Here are some common sequences:
Char.  Decimal Pair     Hex Pair    Char.  Decimal Pair    Hex Pair
ALT-A     (00,30)    (0x00,0x1e)    ALT-B    (00,48)    (0x00,0x30)
ALT-C     (00,46)    (0x00,0x2e)    ALT-D    (00,32)    (0x00,0x20)
ALT-E     (00,18)    (0x00,0x12)    ALT-F    (00,33)    (0x00,0x21)
ALT-G     (00,34)    (0x00,0x22)    ALT-H    (00,35)    (0x00,0x23)
ALT-I     (00,23)    (0x00,0x17)    ALT-J    (00,36)    (0x00,0x24)
ALT-K     (00,37)    (0x00,0x25)    ALT-L    (00,38)    (0x00,0x26)
ALT-M     (00,50)    (0x00,0x32)    ALT-N    (00,49)    (0x00,0x31)
ALT-O     (00,24)    (0x00,0x18)    ALT-P    (00,25)    (0x00,0x19)
ALT-Q     (00,16)    (0x00,0x10)    ALT-R    (00,19)    (0x00,0x13)
ALT-S     (00,31)    (0x00,0x1a)    ALT-T    (00,20)    (0x00,0x14)
ALT-U     (00,22)    (0x00,0x16)    ALT-V    (00,47)    (0x00,0x2f)
ALT-W     (00,17)    (0x00,0x11)    ALT-X    (00,45)    (0x00,0x2d)
ALT-Y     (00,21)    (0x00,0x15)    ALT-Z    (00,44)    (0x00,0x2c)
PgUp      (00,73)    (0x00,0x49)    PgDn     (00,81)    (0x00,0x51)
Home      (00,71)    (0x00,0x47)    End      (00,79)    (0x00,0x4f)
UpArrw    (00,72)    (0x00,0x48)    DnArrw   (00,80)    (0x00,0x50)
LftArrw   (00,75)    (0x00,0x4b)    RtArrw   (00,77)    (0x00,0x4d)
F1        (00,59)    (0x00,0x3b)    F2       (00,60)    (0x00,0x3c)
F3        (00,61)    (0x00,0x3d)    F4       (00,62)    (0x00,0x3e)
F5        (00,63)    (0x00,0x3f)    F6       (00,64)    (0x00,0x40)
F7        (00,65)    (0x00,0x41)    F8       (00,66)    (0x00,0x42)
F9        (00,67)    (0x00,0x43)    F10      (00,68)    (0x00,0x44)
F11       (00,133)   (0x00,0x85)    F12      (00,134)   (0x00,0x86)
ALT-F1    (00,104)   (0x00,0x68)    ALT-F2   (00,105)   (0x00,0x69)
ALT-F3    (00,106)   (0x00,0x6a)    ALT-F4   (00,107)   (0x00,0x6b)
ALT-F5    (00,108)   (0x00,0x6c)    ALT-F6   (00,109)   (0x00,0x6d)
ALT-F7    (00,110)   (0x00,0x6e)    ALT-F8   (00,111)   (0x00,0x6f)
ALT-F9    (00,112)   (0x00,0x70)    ALT-F10  (00,113)   (0x00,0x71)
ALT-F11   (00,139)   (0x00,0x8b)    ALT-F12  (00,140)   (0x00,0x8c)
Hint - If you look at how the keys are laid out on the keyboard, you'll probably see the pattern.