RPN Calculators: INPUT vs PROMPT
Later RPN keystroke programming calculators are able to display alphabetic messages and store to variables for alphabetic names.
HP 32S, HP 32SII, HP 33S, HP 35S, DM32 |
HP 41C (all variants), DM41X |
HP 42S, DM42, DM42n, Free 42 |
Single letter variable names |
Numeric-named variables only |
Both numeric-named variables and alphabetic (and alphanumeric) variable names. Alphabetic and alphanumeric named variables are enclosed in quotes (alpha strings) well stored and recalled and take additional memory. |
Can display messages by setting Flag 10 and using the equation feature to type messages |
Can display messages and prompts |
Can display messages and prompts |
Two common ways to cue the user to enter values are the INPUT and PROMPT commands.
The INPUT Command: HP 32 and HP 42S (and Swiss Micros/emulator equivalents)
Note: The INPUT command is not available in the HP 41C’s command set.
General syntax: INPUT var
When an INPUT command is encountered, the screen will display [var]?= on the X stack.
Example:
INPUT R displays R? [previous value stored in R]
HP 32 Family: The variable is a single-letter name or the indirect variable i.
HP 42S Family: A custom alpha variable, a numeric-named variable (i.e. 00, 01, 02, etc.), indirect variables, or the stack levels X, Y, T, Z, or L (last argument).
The INPUT has the double benefit of storing whatever is entered into the variable asked for. INPUT will also show the previously stored value, so we can just accept it by pressing R/S to keep the old value.
Example: Volume of a Cone
HP 32 family |
HP 42S family |
V01 LBL V V02 INPUT R V03 INPUT H V04 π V05 RCL R V06 x^2 V07 × V08 RCL H V09 × V10 3 V11 ÷ V12 RTN
No quotes are needed for alphabetic variables.
|
00 {30-Byte Prgm } 01 LBL “VCONE1” 02 INPUT “R” 03 INPUT “H” 04 PI 05 RCL “R” 06 x↑2 07 × 08 RCL “H” 09 × 10 3 11 ÷ 12 RTN
We could use variables 00 and 01 (for example) for radius and height, respectively, except the input command prompt will show “R00?” or “R01?” which may not be user-friendly.
The INPUT does not replace the contents of the alpha register.
If we want the alphanumeric/alphanumeric variables (“R”, “H”) to be erased, we could have inserted CLV “R” and CLV “H” at the end, but that will erase the value associated with them. |
The PROMPT Command: HP 41C and HP 42S (and Swiss Micros/emulator equivalents)
Note: The PROMPT command is not available on the HP 32S family.
General Syntax:
“alpha string”
PROMPT
STO var
The alpha string is displayed until something, usually a numeric value, is entered. Unlike the INPUT command, the PROMPT does not automatically store the entered value into a variable. Therefore, if you want to use the value for future use, a STO (store) command must be used following the prompt.
Let’s take our volume of the cone example again:
HP 41C family |
HP 42S family |
01 LBL “VCONE2” 02 ^T RADIUS? 03 PROMPT 04 STO 00 05 ^T HEIGHT? 06 PROMPT 07 STO 01 08 PI 09 RCL 00 10 X↗2 11 * 12 RCL 01 13 * 14 3 15 / 16 RTN
R00 = radius R01 = volume |
00 { 40-Byte Prgm } 01 LBL “VCONE2” 02 “RADIUS?” 03 PROMPT 04 STO 00 05 “HEIGHT?” 06 PROMPT 07 STO 01 08 PI 09 RCL 00 10 X↑2 11 × 12 RCL 01 13 × 14 3 15 ÷ 16 RTN
R00 = radius R01 = volume
With PROMPT, I like to use the numeric-named memory registers, but we can use alphabetic or alphanumeric registers as well. |
HP 32SII/DM32: Simulating PROMPT with Flag 10
Even though the HP 32SII does not have a PROMPT command, we can kind of simulate it by using the equation message feature.
To set flag 10: [ |→ ] [ × ]* (FLAGS), { SF }. [ . ] [ 0 ]
To clear flag 10: [ |→ ] [ × ]* (FLAGS), { CF }. [ . ] [ 0 ]
We have to use the decimal point key in order to access flags beyond 9.
(*HP 35S: [ ←| ] [ ↑ ] (FLAGS))
HP 32SII/33S/35S/DM32 |
|
W01 LBL W W02 SF 10 W03 “=RADIUS” W04 STO R W05 “=HEIGHT” W06 STO H W07 CF 10
W08 π W09 RCL R W10 x^2 W11 × W12 RCL H W13 × W14 3 W15 ÷ W16 RTN |
Turn message mode on Enter as an equation =RADIUS Enter radius and press [R/S] Enter as an equation =HEIGHT Enter height and press [R/S] Turn message mode off, so equations can operate normally
|
Note: Equations are NOT on the original HP 32S.
I hope you find this helpful.
Eddie
All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.
The author does not use AI engines and never will.