Re: A83: wait 'til no key is pressed


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

Re: A83: wait 'til no key is pressed




In a message dated 19/02/00 16:07:15 GMT Standard Time, 
matthias.sauppe@gmx.de writes:
 
> But the 2nd part of this routine does not work (as long as clear is pressed
> the routine should repeat). I don't want to use _getkey because this is only
> an example and I handle 2nd and ALPHA presses myself. Is there a general
> routine that waits until no key is pressed (every key)? I cannot find
> anything about it in asmguru and other docs. 

Two things. Firstly the value read back is (as AsmGuru says) dependent on
which keys are pressed but your routine only works if that is the only key
pressed in the appropriate "key row".

You are testing CP 191. 191 is $BF in Hex or 1011 1111 in binary

You are actually waiting for this bit (Bit 6) to go to logic '1'. If any other
key in this row is pressed other bits will be logic '0'.

Rather than use CP 191, use BIT 6,A will which will set Z if the
relevant key is pressed.

If you want to check for all keys released in this row, rather than
check for being <> 191 (i.e. it is not true that only this key is pressed)
check for = 255 (i.e. all keys in this row are not pressed).

However, there is another issue. Keys "bounce". What this means is
when you press or release a key you get a short period where the
keys go on/off/on/off/on very fast (when the contacts are very close
together). Because of this, it is normal to check the depression is
a real one. An easy way of doing this is to put a delay between the
2 loops, so that the bounce on the key being pressed is not picked
up as a spurious key release,



Follow-Ups: