Results 1 to 3 of 3

Thread: Keyboard handler

  1. #1
    ChimpFace9000
    Guest

    Post 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.

  2. #2
    ChimpFace9000
    Guest
    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.

  3. #3
    Junior Member
    Join Date
    Jun 2000
    Posts
    28
    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
  •  



Click Here to Expand Forum to Full Width