我被这个东西卡住了,我想看看是否按下了右移按钮,所以我有这个 assambler 代码:
mov ah,2
int 16h ;calling INT 16,2 - Read Keyboard Flags interrupt
mov ah,10000000b
shl al,7
and al,10000000b
cmp al,ah ;check if first bit is 1
je rshift
jmp final
rshift:
mov ah,9
lea dx,rsh ;rsh is a string that says that "right shift button has been pressed"
int 21h
jmp final
final: ; quit program
mov ax,4c00h
int 21h
为什么它不工作?,我认为问题是 int 16,2 不能正常工作,如果是这样,为什么会这样?这是 INT 16,2 应该做的:
AH = 02
on return:
AL = BIOS keyboard flags (located in BIOS Data Area 40:17)
|7|6|5|4|3|2|1|0| AL or BIOS Data Area 40:17
| | | | | | | `---- right shift key depressed
| | | | | | `----- left shift key depressed
| | | | | `------ CTRL key depressed
| | | | `------- ALT key depressed
| | | `-------- scroll-lock is active
| | `--------- num-lock is active
| `---------- caps-lock is active
`----------- insert is active
我从来没有看到这条消息,我在调试中查看了 AL 寄存器,在我调用 INT 16,2 后它似乎没有改变。我在 x86 架构上运行 Win 7,我正在使用 tasm