From 8c98d2a737044287ae763d2044c81095f6ff0cba Mon Sep 17 00:00:00 2001 From: Anton_K Date: Sun, 1 Mar 2015 18:25:37 +0000 Subject: [PATCH] Dungeons game: fix keyboard input handling git-svn-id: svn://kolibrios.org@5492 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/Dungeons/Dungeons.asm | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/programs/games/Dungeons/Dungeons.asm b/programs/games/Dungeons/Dungeons.asm index 730e1a2eb1..bd341b5060 100644 --- a/programs/games/Dungeons/Dungeons.asm +++ b/programs/games/Dungeons/Dungeons.asm @@ -734,6 +734,21 @@ proc main_loop endp ; ============================================================================ ; +; ============================================================================ ; +; < eax = key scancode (1 byte) ; +; ============================================================================ ; +macro wait_for_scancode +{ + local .wait + +.wait: + mcall 2 + test al, al + jnz .wait + + shr eax, 8 +} + ; ============================================================================ ; ; < eax = key scancode / 0 - no keys ; ; ============================================================================ ; @@ -750,8 +765,10 @@ proc get_key cmp eax, 0E1h jne @f - mcall 2 - mcall 2 + + wait_for_scancode + wait_for_scancode + xor eax, eax jmp .exit @@ -761,8 +778,9 @@ proc get_key cmp eax, 0E0h jne @f - mcall 2 - shr eax, 8 + + wait_for_scancode + mov ecx, eax or eax, 0E000h mov ebx, 128 @@ -794,6 +812,7 @@ proc get_key mov [PressedKeys + ebx * 4], edx .exit: + ;DEBUGF DEBUG_FINE, 'get_key: %x\n', eax:4 ret endp ; ============================================================================ ;