|
-
Oct 11th, 2001, 04:22 PM
#1
Keyboard handler
Does anyone know of any tutorials on how to make a keyboard handler for a game in assembly? All it has to do is set the appropriate byte in a 256 byte array to 1 when its pressed and 0 when its not pressed.
-
Oct 13th, 2001, 03:35 AM
#2
Ok, i found a tutorial on how to write a handler in c, so i tried to follow it and do it in asm. I got a problem though. When i press a key, it sets the appropriate byte in the array to 1, but when i let go, it doesnt set it back to 0. Heres the code...
Code:
new9 proc
in al, 60h
mov bl, al
xor bh, bh
mov al, 20h
out 20h, al
mov al, bl
and al, 80h
jz short keyoff
sub bl, 80h
mov _keys[bx], 1h
jmp short endkey
keyoff: mov _keys[bx], 0h
endkey: iret
new9 endp
_keys is of course the 128 byte array. Anything would be helpful.
-
Oct 15th, 2001, 02:30 AM
#3
Junior Member
I think you have "and al,80" when you mean "test al,80" - you are deleting the keycode
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|