有没有办法在汇编中将键盘重复延迟设置为零?
Is there a way to set keyboard repetition delay to zero in assembly?
我正在制作一个汇编程序,它根据按下的键在屏幕上移动一个像素。
根据here修改重复延迟的方法是使用
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 功能,而是直接访问 keyboard controller。
在你的代码中
mov bh, 00h ;repeat delay: 250ms <-- this has to be 0
正在尝试设置重复延迟的值,值0
代表250ms,在BIOS/via BIOS中断中可以设置的最小值。您可以在 Ralph Brown's interrupt list.
上验证这一点
我正在制作一个汇编程序,它根据按下的键在屏幕上移动一个像素。
根据here修改重复延迟的方法是使用
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 功能,而是直接访问 keyboard controller。
在你的代码中
mov bh, 00h ;repeat delay: 250ms <-- this has to be 0
正在尝试设置重复延迟的值,值0
代表250ms,在BIOS/via BIOS中断中可以设置的最小值。您可以在 Ralph Brown's interrupt list.