Re: A82: multiple keypresses


[Prev][Next][Index][Thread]

Re: A82: multiple keypresses



In a message dated 97-12-04 04:03:23 EST, you write:

> Hey.  Blockbuster (the game I'm working on) is going quite well.  For
>  the next part, I need to know how to read multiple keypresses, like if
>  2nd and down are being pressed at the same time.  I assume this would
>  use the keyboard port.  How would I go about doing this?  Thanks!
>  
>  --
>  Doug Torrance
>  profzoom@earthling.net
>  http://profzoom.home.ml.org
>  (:  Have a happy day!  :)

just check if the first key is pressed (2nd), then jump somewhere where all of
the arrows are checked.
Example code:

keyloop1:
  ld a, SECOND_MASK              ;;offhand I don't know what this stuff is
  out (1), a
  in a, (1)
  bit SECOND_BIT, a                ;;same thing here
  jr z, keyloop2
  ...more code...
  jr keyloop1

keyloop2:
  ld a, ARROW_MASK                 ;;again
  out (1), a
  in a, (1)
  bit UP, a
  jr z, MOVE_UP                                         ;;functions for up
  ...more stuff for each arrow...
  jr keyloop1

I assume this would work, though I've never had to read multiple keypresses
(not yet at least...)
Hope I was some help,

~Adamman