assembly - 有没有办法在汇编中将键盘重复延迟设置为零?
问题描述
我正在制作一个汇编程序,根据按下的键在屏幕上移动一个像素。
根据这里修改重复延迟的方法是使用
mov ah, 03h
mov al, 05h ;set typematic rate/delay
mov bh, 00h ;repeat delay: 250ms <-- this has to be 0
mov bl, 00h ;typematic rate: 30
int 16h
这是整个代码
cmp [keypress], 'a'
je left
cmp [keypress], 'A'
je left
cmp [keypress], 'd'
je right
cmp [keypress], 'D'
je right
jmp endMove
left:
dec xpos
jmp endMove
right:
inc xpos
jmp endMove
endMove:
call drawPixel
input:
mov keypress, 0
mov ah, 01h
int 16h
jnz animLoop
mov ah, 00h
int 16h
mov keypress, al
jmp animLoop
它工作正常,除了键盘重复延迟使像素移动一次,然后停止 250 毫秒,然后重新开始连续移动而没有问题。如何消除重复延迟?
解决方案
可以在 BIOS 选项中配置此延迟(以及重复率)。如果要绕过它,则不应使用 BIOS 功能,而应直接访问键盘控制器。
在您的代码中
mov bh, 00h ;repeat delay: 250ms <-- this has to be 0
尝试设置重复延迟的值,该值0
代表 250 毫秒,可以在 BIOS 中/通过 BIOS 中断设置的最小值。您可以在Ralph Brown 的中断列表上验证这一点。
推荐阅读
- swiftui - 在 SwiftUI 中更改 GroupBox 背景颜色
- ios - 在 Swift 中快速 UInt 到 Float 转换
- sql-server - 表更新因在 SQL Server 中的存在而受到影响
- php - 如何阻止除 Chromium 之外的所有 IE 和 Microsoft Edge
- amazon-web-services - MQTT.fx 无法连接到 AWS IoT (MqttException)
- javascript - 函数返回函数理解它为什么工作
- mysql - 一个日期的Mysql查询输出空白并且适用于另一个日期
- scala - Encoders.product[of a scala trait ].schema in spark
- firebase - 有没有办法使用firebase在后端执行查询?
- macos - 有没有办法在 macOS 的 shell 脚本中返回当前基于区域的十进制和千位分隔符?