我有一个用emu8086编写的简单EXE代码,它在屏幕上移动一个字符(现在):
黄色的“*”随着箭头键移动。
问题是模拟器获得 16 次按键。我的意思是当我如此快速地按键(或按住一个键)时,它会将按键保持在堆栈中并根据它们移动“*”。例如:
在上图中,“*”根据我之前按下的键移动了 14 次!
我不希望它把我的按键放在一个堆栈中。如何根据最后按下的键而不是堆栈进行实时反应?
PS:这是我从用户那里得到按键的部分,在当前位置打印一个空字符并将“*”移动到新位置:
check_for_key:
; === check for player commands:
mov ah, 01h
int 16h
jz no_key
mov ah, 00h
int 16h
mov cur_dir, ah
; print ' ' at the location:
mov al, ' '
mov ah, 09h
mov bl, 0eh ; attribute.
mov cx, 1 ; single char.
int 10h
call move_star