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.
相关问题
- Why should we check WIFEXITED after wait in order
- Null-terminated string, opening file for reading
- What's the difference between 0 and dword 0?
- Linux kernel behaviour on heap overrun or stack ov
- Translate the following machine language code (0x2
相关文章
- What happens to dynamic allocated memory when call
- Is it possible to run 16 bit code in an operating
- How to generate assembly code with gcc that can be
- Select unique/deduplication in SSE/AVX
- Optimising this C (AVR) code
- Why does the latency of the sqrtsd instruction cha
- Difference in ABI between x86_64 Linux functions a
- x86 instruction encoding tables
You can handle IRQ 1 (mapped to interrupt 9 by the x86 controller) and read the keys from port
60h
.See http://inglorion.net/documents/tutorials/x86ostut/keyboard/.
Minimal GAS boot sector BIOS example
When you enter a character, it gets printed to the screen.
main.S
Compile and run:
GitHub upstream.
Tested on Ubuntu 14.04 AMD64, Binutils 2.24, QEMU 2.0.0 and on real hardware Lenovo Thinkpad T400.
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
withAH=00h
or10h
will block waiting for a keypress (returns ASCII result inAL
); useAH=01h
or11h
to query whether a keypress is available first if you want to avoid blocking (returns immediately withZF
clear if a key is available, or set if not). See e.g. here, or here (or Google "INT 16h" for more).