简体   繁体   中英

Assembly8086 - how to get input from arrow keys

So I'm familiar with int 21h in assembly that gets keyboard input from the user based on ASCII code. In my code I want to make the user able to use the arrow keys, I searched around the internet and did not find a clear answer about the arrow keys ASCII code. How can I get arrow keys input from the user in Assembly?

All keys on your keyboard generate scan codes .

Some of those keys correspond to characters, so their scan codes are converted to character codes and are made available via services like int 21h .

However, keys that do not correspond to characters are not converted. An example of such keys are the arrow keys.

So, you cannot obtain ASCII codes of arrow keys, because there is no such thing.

What you can obtain, is the scan codes of the arrow keys.

So, you need to look for the BIOS interrupt that gives you raw scan codes.

Start here: https://en.wikipedia.org/wiki/INT_16H -- Good luck, and have fun!

您可以使用int 21h的子函数6,它将返回0x00,这意味着您需要再次调用它以获得扩展代码。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM