8086听键盘同时借鉴 [英] 8086 listen to keyboard while drawing

查看:268
本文介绍了8086听键盘同时借鉴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我熟悉等待键盘输入INT 16H,但我正在开发一个游戏,我想那里是一个游戏循环,在屏幕上动画的东西,每当有一个键盘命中, 8086应该去我的中断处理程序,并告诉我哪个键已经pssed相应地更新我的数据$ p $。

I'm familiar with INT 16h that waits for keyboard input, but I'm developing a game and I would like there to be a game loop, that animates things on the screen, and whenever there is a keyboard hit, the 8086 should go to my interrupt handler and tell me which key has been pressed to update my data accordingly.

我怎么可以这样做?

推荐答案

您也可以用1 AH而不是0,调用INT 16时轮询输入。

You can also poll for input with 1 in AH instead of 0, when calling INT 16.

INT 16h / AH = 01h - check for keystroke in the keyboard buffer.

    return:

        ZF = 1 if keystroke is not available.
        ZF = 0 if keystroke available.
        AH = BIOS scan code.
        AL = ASCII character.
        (if a keystroke is present, it is not removed from the keyboard buffer). 

(来源)

这篇关于8086听键盘同时借鉴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆