Re: A92: Waiting for nokey?
[Prev][Next][Index][Thread]
Re: A92: Waiting for nokey?
At 15:52 1997-08-12 -0700, you wrote:
>At 05:02 PM 8/12/97 +0200, you wrote:
>>How do I "wait until no key is down" when using the keyboard matrix?
>>
>>I've tried the obvious, setting all rows to 0, nop:ing, and testing if the
>>columns were zero with tst.b ($6000xx).
Nobody noticed my fatal mistake here? To check if $60001B was *ZERO*.
Hey, let's make a loop that checks if *ALL KEYS ARE PRESSED* ;-)
>>Should I use the keyboard buffer?
>
>Can you un-mask multiple rows or columns when reading from the port?
Yep, but you'll have to be mighty clever to make use of it.
>How I would do it is start with %11111110 and set up a loop that sends to
>the port and then checks if the result is $FF, if not, at least one key is
>down, if it is $FF, all the keys in that row are not being pressed, so
>rotate what you are using as your current keymask and loop.
I now use the following routine:
;*********** Wait NoKey ***********
;* Pauses until no key is pressed *
;**********************************
wait_nokey:
move.w #%1111110000000000,($600018) ;Check for any key
nop
nop
nop
nop
nop
nop
cmp.b #$FF,($60001B)
bne.s wait_nokey
rts
Niklas Brunlid (e96nbr@efd.lth.se or nma95nbr@student1.lu.se)
PQF Quote follows:
The man gave a shrug which indicated that, although the world did indeed
have many problems, this was one of them that was not his.
-- (Terry Pratchett, Soul Music)
References: