如何使用IN指令组件保护模式使用组合键?

时间:2014-06-27 08:08:34

标签: assembly protected-mode

我正在使用此代码从键盘获取输入但我无法想办法获得组合键,例如“shift + a”= A

keypressed:
     in al,60h
     test al,80h
     jnz keypressed
     and al,7fh
     mov bx,table
     dec al
     xlat
     cmp al,0
     je key
         call put_char
key:
     in al,60h
     test al,80h
     jz key
     jmp keypressed 

table db 0x01,"1234567890-=",0X0E,0x0F,'qwertyuiop[]',0x1C,0,"asdfghjkl;'",0,0,0,"zxcvbnm,./",0,0,0," ",0

注意 - putchar是我制作的一个程序,可以在al中打印任何东西。

2 个答案:

答案 0 :(得分:0)

您必须跟踪shift shift-down和key-up事件,并根据需要将shift状态应用于其他键事件。或者,只需使用BIOS,它将自动为您完成所有工作。

答案 1 :(得分:-1)

轮询端口以从键盘获取密钥的示例:

in al,64h       ; get the statusbyte from the keyboard
test al, 1      ; check if a byte is inside of the outputbuffer
jz short NOKEY
test al, 20h    ; check if the byte is coming from the PS2-mouse
jnz short NOKEY
in al, 60h      ; get the key from the outputbuffer
.....           ; <- place your code here
NOKEY:

德克