键盘中断如何始终在端口 60 上访问?
我正在学习操作系统和引导加载程序。我发现,要读取键盘按键,可以使用端口 60 的 in
汇编助记符。即使在编写在现代计算机上运行的低级汇编程序时,这也有效。
我正在阅读此
keyhandler:
in al, 0x60 ; get key data
mov bl, al ; save it
mov byte [port60], al
in al, 0x61 ; keybrd control
mov ah, al
or al, 0x80 ; disable bit 7
out 0x61, al ; send it back
xchg ah, al ; get original
out 0x61, al ; send that back
mov al, 0x20 ; End of Interrupt
out 0x20, al ;
and bl, 0x80 ; key released
jnz done ; don't repeat
mov ax, [port60]
mov word [reg16], ax
call printreg16
机器如何知道将插入例如任意 USB 连接器的键盘路由到端口 60,以便程序员可以访问它?
I am in the process of learning about operating systems and bootloaders. I have found that, to read keyboard keypresses, one can use the in
assembly mnemonic with port 60. This works even when writing low-level assembly programs running on a modern machine.
I was reading this article on the topic, in order to better understand this snippet:
keyhandler:
in al, 0x60 ; get key data
mov bl, al ; save it
mov byte [port60], al
in al, 0x61 ; keybrd control
mov ah, al
or al, 0x80 ; disable bit 7
out 0x61, al ; send it back
xchg ah, al ; get original
out 0x61, al ; send that back
mov al, 0x20 ; End of Interrupt
out 0x20, al ;
and bl, 0x80 ; key released
jnz done ; don't repeat
mov ax, [port60]
mov word [reg16], ax
call printreg16
How does the machine know to route a keyboard plugged into, for example, an arbitrary USB connector to port 60 so it is accessible for the programmer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论