!pr2
!lm12
!rm75
Yes/No Subroutine.......................Bob Sander-Cederlof

It happens all the time!  I am continually needing to ask Yes/No questions in my programs.  I do it now with the following subroutine, which has been somewhat stripped down for publication.

Assume you have just printed the question itself on the screen, preferably with " (Y/N)?" on the end.  Then call my subroutine with "JSR YES.NO".  The subroutine will clear the keyboard strobe, so that it is sure it is getting the answer to this question, and not just a stray character you accidentally typed.  Then as soon as you hit any key, it will put it on the screen where the question ended and return to you.

At the point you should use BNE to branch where you want to if the user has typed something other than "Y" or "N".  Once that is out of the way, use BCC or BCS to branch on whether it was "Y" or "N".  The subroutine sets carry for "N" and clears carry for "Y".

In my actual programs, I have one more line between 1120 and 1130.  It is JSR MESSAGE.PRINTER, which expects a message number in the Y-register.  You can use it either way.  You might also like to insert two more lines to call the message printer to print " (Y/N)?  " for every question; that way the common string does not have to be repeatedly stored in memory with every question.
