EasyManuals Logo
Home>WP>Calculator>WP-34S

WP WP-34S User Manual

WP WP-34S
103 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #93 background imageLoading...
Page #93 background image

Edition 2.2
Page 93 of 103
shorthand addressing. If you want to associate a program with the key , just put the
label 21 in front of the routine and it can be conveniently called with  by the
user.
Direct Keyboard Access
The same codes are returned by the KEY? command which allows true "real time" re-
sponse to user input from the keyboard. KEY? takes a register argument (X is allowed
but does not lift the stack) and stores the key most recently pressed during program
execution in the specified register. R/S and EXIT cannot be queried, they stop program
execution immediately. The keyboard is active during execution but it is of course desir-
able to show a message and suspend the program with the PSE command while waiting
for user input. PSE is interrupted by a key press, so you can simply use a PSE 99
statement in a loop to wait for input. KEY? acts as a conditional at the same time so a
typical user input loop will look like this:
LBL 'USR'
CLα
α 'KEY'
α ?
LBL 00
αVIEW
PSE 99
KEY? 00
GTO 00
LBL?->00
XEQ->00
GTO 00
This code fragment prompts for a key and stores it in register 00. The line directly after
KEY? is executed when no key was pressed. The statement KEY? is only executed
every 9.9 seconds if the user does not press a key. If he does, the PSE is immediately
terminated, KEY? is executed, finds the key code and stores it in register 00. The
LBL00 instruction checks if a label corresponding to the key code has been defined
and executes it if found. Instead of the dumb waiting loop, the program can do some
computations and update the display before the next call to PSE and KEY? think of a
lunar lander game.
To be even more versatile, the instruction KTY? nn is designed to return the key type
of a row / column code in register nn: 0 to 9 for the respective digits, 10 for the other
numeric keys (. , +/- and EEX), 11 for any of the three shift keys and 12 for the rest. An
invalid code in the target register throws an "Invalid Range Error".
If you decide not to handle the key in the program you may feed it back to the main
processing loop of the calculator with the PUTK nn command. What happens is that
the program halts and the key is treated as if pressed after the stop. This is especially
useful if you want to allow numeric input while waiting for some special keys like the ar-
rows. This allows writing of a vector or matrix editor in user code. After execution of the
PUTK command the user is responsible for letting the program continue its work by
pressing or a hot key.

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the WP WP-34S and is the answer not in the manual?

WP WP-34S Specifications

General IconGeneral
BrandWP
ModelWP-34S
CategoryCalculator
LanguageEnglish