如何通过BIOS中断以实模式处理键盘? [英] How to handle keyboard in real mode through BIOS interrupts?
问题描述
我必须为可以在其上运行计算器的操作系统编写代码,就像台式机一样.为此,我正在阅读 brokenthorn操作开发系列,我已经完成了
I have to code for a operating system on which I can run a calculater.It is like a desktop calculater. For this I am reading the brokenthorn operating development series I have completed the second stage of bootloader The bootloader is in real mode. After this the author is explaining the protected mode. I don't want to use the protected mode. I don't have time for that. So I want to write the calculater in real mode by using bios interrupts. Is it possible? I think it can be written on the second stage of the bootloader(I am not sure.) Means I don't have to use a kernel(I am not sure). I don't know how to use BIOS interrupts to handle the keyboard. Can anybody provide me a link which will help me in this? And If anything wrong in whatevet I assumed above is wrong, please correct me.Thanks in advance.
推荐答案
如果您想使用高级BIOS键盘服务,而不是自己处理键盘中断,那么您想要的就是INT 16h
.
If you want to use high-level BIOS keyboard services, rather than handling the keyboard interrupts yourself, then INT 16h
is what you want.
INT 16h
和AH=00h
或10h
将阻止等待按键(在AL
中返回ASCII结果);如果要避免阻塞,请使用AH=01h
或11h
首先查询是否有按键可用(如果有按键可用,立即按ZF
返回,否则设置).参见例如此处,或
INT 16h
with AH=00h
or 10h
will block waiting for a keypress (returns ASCII result in AL
); use AH=01h
or 11h
to query whether a keypress is available first if you want to avoid blocking (returns immediately with ZF
clear if a key is available, or set if not). See e.g. here, or here (or Google "INT 16h" for more).
这篇关于如何通过BIOS中断以实模式处理键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!