Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

Keyboard...

I'm makeing a game where I have to move around human with arrow keys. When I change
the direction the human stops for a short time. I have tried with port $60 but it is still the same.
The value in buffer remains the same and after a short time it changes. But I want to get the
value of the button when I press it.
Please help me.
0
ssdjgru1
Asked:
ssdjgru1
1 Solution
 
kellyjjCommented:
Here is some assembler code that will do what you want:

      asm
      begin
            mov ax,0;
            mov ah,0x10;
            int 16h;
            mov key_char,al;
            mov extn_char,ah;
      end;

You will want to first check to make sure a a key was pressed  ( by calling the boolean func  keypressed  )  then you call this code.  You shoud be able to put this inside a procedure.   This will remove the key pressed from the buffer.  Note:  if no key has been pressed and this code gets called it will just sit there waiting for a key to be pressed.  I hope this helps

0
 
ssdjgru1Author Commented:
Thanx for the code man... it works :))
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now