PANAME X/Y utility
There is a nice utility on the PANAME module labeled "X/Y". It prompts the user for a "y" or "n" keypress and then executes the line after the xeq, in the affirmative, or skips it in the negative. I'd like to use this with some of my own programs. I tried to copy the program to the calculator which resulted in a nonexistent message. If I can't copy it to the calculator, could a similar program be written? Other topics I have found don't mimic this utility.
This code formats and displays the question (up to 7 characters) and uses GETKEY for the user response. It even alerts the user if they pressed the wrong key. A 1 or 0 is left in the X-register, depending on the y or n keypress. I don't know how to implement an X=Y? type behavior when the subroutine returns to the main program.
- Code: Select all
;
; Input yes/no routine
;
LBL "Y/N"
8
ALENG
–
LBL 05
>" "
DSE X
GTO 05
>"Y/N?"
LBL 00
AVIEW ; Display question and get answer
GETKEY ; Yes or no?
SF 25 ; Ignore invalid key error
GTO IND X
SIZE?
DSE X
STO 00
ASTO IND X
ASHF
DSE X
ASTO IND X
"WHAT ?"
AVIEW
PSE
CLA
RCL 00
ARCL IND X
DSE X
ARCL IND X
GTO 00
LBL 71 ; returned 71 for the Y key
1 ; Enter 1
RTN
LBL 41 ; returned 41 for the N key
. ; Enter 0
END
This code formats and displays the question (up to 7 characters) and uses GETKEY for the user response. It even alerts the user if they pressed the wrong key. A 1 or 0 is left in the X-register, depending on the y or n keypress. I don't know how to implement an X=Y? type behavior when the subroutine returns to the main program.