本附录中的各表列举了键盘按键扫描码和其ASCII码之间的对照关系,表中数据都是十六进制形式。
在用中断16H的0号功能时,当按下任意一个键或组合键时,寄存器AH和AL分别保存着该按键的扫描码和ASCII码。
表1、ASCII码的编码方案
高位 | 低位 | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 |
---|
0000 | NUL | DEL | SP | 0 | @ | P | ` | p |
0001 | SOH | DC1 | ! | 1 | A | Q | a | q |
0010 | STX | DC2 | “ | 2 | B | R | b | r |
0011 | ETX | DC3 | # | 3 | C | S | c | s |
0100 | EOT | DC4 | $ | 4 | D | T | d | t |
0101 | ENQ | NAK | % | 5 | E | U | e | u |
0110 | ACK | SYN | & | 6 | F | V | f | v |
0111 | BEL | ETB | ‘ | 7 | G | W | g | w |
1000 | BS | CAN | ( | 8 | H | X | h | x |
1001 | HT | EM | ) | 9 | I | Y | i | y |
1010 | LF | SUB | * | : | J | Z | j | z |
1011 | VT | ESC | '+ | ; | K | [ | k | { |
1100 | FF | FS | | < | L | / | l | | |
1101 | CR | GS | - | = | M | ] | m | } |
1110 | SO | RS | . | > | N | ^ | n | ~ |
1111 | SI | US | / | ? | O | _ | o | Del |
表2、字母和空格按键的编码表
按 键 | 单 键 | | SHIFT | | CTRL | | ALT | |
---|
按 键 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 |
a and A | 1E | 61 | 1E | 41 | 1E | 01 | 1E | 00 |
b and B | 30 | 62 | 30 | 42 | 30 | 02 | 30 | 00 |
c and C | 2E | 63 | 2E | 43 | 2E | 03 | 2E | 00 |
d and D | 20 | 64 | 20 | 44 | 20 | 04 | 20 | 00 |
e and E | 12 | 65 | 12 | 45 | 12 | 05 | 12 | 00 |
f and F | 21 | 66 | 21 | 46 | 21 | 06 | 21 | 00 |
g and G | 22 | 67 | 22 | 47 | 22 | 07 | 22 | 00 |
h and H | 23 | 68 | 23 | 48 | 23 | 08 | 23 | 00 |
i and I | 17 | 69 | 17 | 49 | 17 | 09 | 17 | 00 |
j an1 J | 24 | 6A | 24 | 4A | 24 | 0A | 24 | 00 |
k and K | 25 | 6B | 25 | 4B | 25 | 0B | 25 | 00 |
l and L | 26 | 6C | 26 | 4C | 26 | 0C | 26 | 00 |
m and M | 32 | 6D | 32 | 4D | 32 | 0D | 32 | 00 |
n and N | 31 | 6E | 31 | 4E | 31 | 0E | 31 | 00 |
o and O | 18 | 6F | 18 | 4F | 18 | 0F | 18 | 00 |
p and P | 19 | 70 | 19 | 50 | 19 | 10 | 19 | 00 |
q and Q | 10 | 71 | 10 | 51 | 10 | 11 | 10 | 00 |
r and R | 13 | 72 | 13 | 52 | 13 | 12 | 13 | 00 |
s and S | 1F | 73 | 1F | 53 | 1F | 13 | 1F | 00 |
t and T | 14 | 74 | 14 | 54 | 14 | 14 | 14 | 00 |
u and U | 16 | 75 | 16 | 55 | 16 | 15 | 16 | 00 |
v and V | 2F | 76 | 2F | 56 | 2F | 16 | 2F | 00 |
w and W | 11 | 77 | 11 | 57 | 11 | 17 | 11 | 00 |
x and X | 2D | 78 | 2D | 58 | 2D | 18 | 2D | 00 |
y and Y | 15 | 79 | 15 | 59 | 15 | 19 | 15 | 00 |
z and Z | 2C | 7A | 2C | 5A | 2C | 1A | 2C | 00 |
SpaceBar | 39 | 20 | 39 | 20 | 39 | 20 | 39 | 20 |
表3、功能键的编码表
按 键 | 单 键 | | SHIFT | | CTRL | | ALT | |
---|
按 键 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 |
F1 | 3B | 00 | 54 | 00 | 5E | 00 | 68 | 00 |
F2 | 3C | 00 | 55 | 00 | 5F | 00 | 69 | 00 |
F3 | 3D | 00 | 56 | 00 | 60 | 00 | 6A | 00 |
F4 | 3E | 00 | 57 | 00 | 61 | 00 | 6B | 00 |
F5 | 3F | 00 | 58 | 00 | 62 | 00 | 6C | 00 |
F6 | 40 | 00 | 59 | 00 | 63 | 00 | 6D | 00 |
F7 | 41 | 00 | 5A | 00 | 64 | 00 | 6E | 00 |
F8 | 42 | 00 | 5B | 00 | 65 | 00 | 6F | 00 |
F9 | 43 | 00 | 5C | 00 | 66 | 00 | 70 | 00 |
F10 | 44 | 00 | 5D | 00 | 67 | 00 | 71 | 00 |
F11 | 85 | 00 | 87 | 00 | 89 | 00 | 8B | 00 |
F12 | 86 | 00 | 88 | 00 | 8A | 00 | 8C | 00 |
表4、数字键盘的编码表
按 键 | 单 键 | | SHIFT | | CTRL | | ALT | |
---|
按 键 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 |
Ins & 0 | 52 | 00 | 52 | 30 | 92 | 00 | | |
End & 1 | 4F | 00 | 4F | 31 | 75 | 00 | 00 | 01 |
↓ & 2 | 50 | 00 | 50 | 32 | 91 | 00 | 00 | 02 |
PgDn & 3 | 51 | 00 | 51 | 33 | 76 | 00 | 00 | 03 |
← & 4 | 4B | 00 | 4B | 34 | 73 | 00 | 00 | 04 |
5 | 4C | 00 | 4C | 35 | 8F | 00 | 00 | 05 |
→ & 6 | 4D | 00 | 4D | 36 | 74 | 00 | 00 | 06 |
Home & 7 | 47 | 00 | 47 | 37 | 77 | 00 | 00 | 07 |
↑ & 8 | 48 | 00 | 48 | 38 | 8D | 00 | 00 | 08 |
PgUp & 9 | 49 | 00 | 49 | 39 | 84 | 00 | 00 | 09 |
+ | 4E | 2B | 4E | 2B | 90 | 00 | 4E | 00 |
- | 4A | 2D | 4A | 2D | 8E | 00 | 4A | 00 |
Del & ‘.’ | 53 | 00 | 53 | 2E | 93 | 00 | | |
* | 37 | 2A | 37 | 2A | 96 | 00 | 37 | 00 |
表5、第一排数字键盘的编码表
键 | 单 键 | | SHIFT | | CTRL | | ALT | |
---|
按 键 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 |
` and ~ | 29 | 60 | 29 | 7E | | | 29 | 00 |
1 and ! | 02 | 31 | 02 | 21 | | | 78 | 00 |
2 and @ | 03 | 32 | 03 | 40 | 03 | 00 | 79 | 00 |
3 and # | 04 | 33 | 04 | 23 | | | 7A | 00 |
4 and $ | 05 | 34 | 05 | 24 | | | 7B | 00 |
5 and % | 06 | 35 | 06 | 25 | | | 7C | 00 |
6 and ^ | 07 | 36 | 07 | 5E | 07 | 1E | 7D | 00 |
7 and & | 08 | 37 | 08 | 26 | | | 7E | 00 |
8 and * | 09 | 38 | 09 | 2A | | | 7F | 00 |
9 and ( | 0A | 39 | 0A | 38 | | | 80 | 00 |
0 and ) | 0B | 30 | 0B | 29 | | | 81 | 00 |
- and _ | 0C | 2D | 0C | 5F | 0C | 1F | 82 | 00 |
= and + | 0D | 3D | 0D | 2B | | | 83 | 00 |
表6、操作按键的编码表
按 键 | 单 键 | | SHIFT | | CTRL | | ALT | |
---|
按 键 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 |
Esc | 01 | 1B | 01 | 1B | 01 | 1B | 01 | 00 |
Backspace | 0E | 08 | 0E | 08 | 0E | 7F | 0E | 00 |
Tab | 0F | 09 | 0F | 00 | 94 | 00 | A5 | 00 |
Enter | 1C | 0D | 1C | 0D | 1C | 0A | 1C | |
表7、标号按键的编码表
按 键 | 单 键 | | SHIFT | | CTRL | | ALT | |
---|
按 键 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 |
[ and { | 1A | 5B | 1A | 7B | 1A | 1B | 1A | 00 |
] and } | 1B | 5D | 1B | 7D | 1B | 1D | 1B | 00 |
; and : | 27 | 3B | 27 | 3A | | | 27 | |
’ and " | 28 | 27 | 28 | 22 | | | 28 | |
/ and | | 2b | 5C | 2b | 7C | 2B | 1C | 2b | |
, and < | 33 | 2C | 33 | 3C | | | 33 | |
. and > | 34 | 2E | 34 | 3E | | | 34 | |
/ and ? | 35 | 2F | 35 | 3F | | | 35 | |
表8、附加按键的编码表
按 键 | 单 键 | | SHIFT | | CTRL | | ALT | |
---|
按 键 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 | 扫描码 | ASCII码 |
Slash(/) | E0 | 2F | E0 | 2F | 95 | 0 | A4 | 00 |
Enter | E0 | 0D | E0 | 0D | E0 | 0A | A6 | 00 |
Home | 47 | E0 | 47 | E0 | 77 | E0 | 97 | 00 |
End | 4F | E0 | 4F | E0 | 75 | E0 | 9F | 00 |
PageUp | 49 | E0 | 49 | E0 | 84 | E0 | 99 | 00 |
PageDown | 51 | E0 | 51 | E0 | 76 | E0 | A1 | 00 |
DnArrow | 50 | E0 | 50 | E0 | 91 | E0 | A0 | 00 |
LeftArrow | 4B | E0 | 4B | E0 | 73 | E0 | 9B | 00 |
RightArrow | 4D | E0 | 4D | E0 | 74 | E0 | 9D | 00 |
UpArrow | 48 | E0 | 48 | E0 | 8D | E0 | 98 | 00 |
Ins | 52 | E0 | 52 | E0 | 92 | E0 | A2 | 00 |
Del | 53 | E0 | 53 | E0 | 93 | E0 | A3 | |
表9、其它按键的扫描码
当这些键被按下时,BIOS并没有把它们的扫描码输入键盘缓冲区。
按 键 | 扫描码 |
---|
CapsLock | 3A |
NumLock | 45 |
ScrollLock | 46 |
Shift(Left) | 2A |
Shift(Right) | 36 |
Alt | 38 |
Ctrl | 1D |
PrtScreen | 37 |
所有评论(0)