

Task

Obtain a valid   Y   or   N   response from the keyboard.

The keyboard should be flushed, so that any outstanding key-presses are removed, preventing any existing   Y   or   N   key-press from being evaluated.

The response should be obtained as soon as   Y   or   N   are pressed, and there should be no need to press an   enter   key.




 
; Stores result in cell 2; 1 if yes, 0 if no.
:YORN
PRINT YORNMSG
:YORN1
INPUT >2
AND *2,$5F,'Y >2 /YORN2
AND *2,,'N \YORN1
:YORN2
PRINTC *2
PRINTC 13
AND *2,1 >2
RETURN
:YORNMSG " (Y/N)? \
 