

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.




wait_for_key_input:
call &BB06 ;bios call, waits until key is pressed, returns key's ASCII code into A
and %11011111        ;converts to upper case
cp 'Y'              
jp z,User_Chose_Yes
cp 'N'
jp z,User_Chose_No
jp wait_for_key_input
 
User_Chose_Yes:
;your code for what happens when the user types "Y" goes here
ret
 
User_Chose_No:
;your code for what happens when the user types "N" goes here
ret