Showing posts with label keystroke programming. Show all posts
Showing posts with label keystroke programming. Show all posts

Saturday, October 11, 2025

RPN Calculators: INPUT vs PROMPT

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.

Friday, October 10, 2025

Retro Review: HP 67

Retro Review: HP 67


I won a HP 67 from the HHC 2025 Conference in Orlando, Florida last September. Be on the lookout for a list of videos by the hpcalc.org's YouTube page soon. It's always a good time.


Bruce Gordon donated the HP 67 to the conference and I'm grateful and appreciative. I love the box, the calculator, the leather cover, and the manuals.









Quick Facts


Company: Hewlett Packard

Years: 1976 - 1984

Type: Scientific, RPN (Reverse Polish Notation)

Memory: 20 memory registers, 224 steps


Batteries: originally Ni-Cad, there are battery packs that can use AAA batteries (Ebay seller: waterhosko, https://www.ebay.com/usr/waterhosko)


DISCLAIMER:  I am not page for referring the website on eBay, nor I do not guarantee that inventory is available.  


Features:


* Trigonometric, logarithmic, exponential functions

* Probability: n! (the factorial function only accepts positive integers)

* Integer part, fractional part, absolute value, round to fix settings

* Polar/Rectangular, Degree/Radian, Hours/Hours-Minutes-Seconds (HMS) conversions

* Percent and percent change


Non-Continuous Memory


The memory on the HP 67 is not continuous. When the calculator is turned off, all memory is lost. The only way to save the memory registers and the steps require the use of thin memory cards and the built-in card reader. Each card has two sides, which can hold 112 steps per side. With decades-old calculators like the HP 67, the card reader has stopped working. It can be repaired and when I get the chance, I will leave it to the repair experts.


Memory Registers


There are 20 memory registers but they are split up: 10 primary registers and 10 secondary registers. The set of registers can be switch by pressing [ f ] (P<>S). This really comes into play when working with statistical data (see next section).


Statistics


The HP 67 has the standard statistics functions including sums, means, and standard deviations. When calculating statistics, the following stored on the secondary registers:


RS9 (19): n

RS8 (18): Σxy

RS7 (17): Σy^2

RS6 (16): Σy

RS5 (15): Σx^2

RS4 (14): Σx


Clearing these registers require this key sequence: [ f ] (CL REG) [ f ] (P<>S). To access the statistics registers after entering the data, start by pressing [ f ] (P<>S).


The mean function, [ f ] (x-bar):

Y: average of y-values

X: average of x-values


The standard sample deviation, [ g ] (s):

Y: sample deviation of y-values

X: sample deviation of x-values


Programming


As mentioned before, the HP 67 can hold programs up to 224 program steps. Steps involving shift keys [ f ], [ g ], and [ h ], along with [ GTO ] and [ LBL ], are merged with the next key press to help save space. However, each press of the digit keys and the decimal point take one step each. For instance, 475.2 takes five steps ([ 4 ], [ 7 ], [ 5 ], [ . ], [ 2 ]) while sequences such as [ GTO ] [ 1 ] and [ f ] (√x) take one step each.


Always available are five user keys that double as ten lettered labels: A, B, C, D, E, a, b, c, d, and e. The lower case labels are shifted of their capital letter counter parts. There are also ten numerical labels, 0-9, available for use.


There are eight comparison tests:


Gold tests (use the [ f ] shift): x=0, x≠0, x<0, x>0

Blue tests (use the [ g ] shift): x=y, x≠0, x≤y, x>y


The registers I and (i) are used for indirect addressing. We have special functions to store to Register I, the ST I and RC I functions. The DSZ and ISZ only work on register 1.


DSZ: Decrease register I by 1 and skip the next instruction if the result is I=0.

ISZ: Increase register I by 1 and skip the next instruction if the result is I=0.


There are four flags. Flags 0, 1, and 2 are user flags. Flag 2 gets cleared automatically when tested. Flag 3 is the entry flag, which is set automatically when a number is entered or a data card is read. Like Flag 2, Flag 3 is cleared automatically when tested.


For more details, here is an excellent article on HP-67 (and the similar HP-97) programming by the MoHPC (Museum of HP Calculators) web page: https://www.hpmuseum.org/prog/hp67prog.htm


As mentioned before, when the calculator is turned off, all memory is reset. When available, save your programs to a data card first.



Program Collection


Download here:

https://drive.google.com/file/d/114H4D0hcOjxDj_MHQNvwDBUJV3chlpdC/view?usp=sharing



List of Programs (all programs on the file are relatively short, less than 35 steps):


Countdown of HP 67 "seconds"

Random Numbers

Snell's Law

Circle: Area and Circumference

Sphere: Surface Area and Volume

Angle Between 2 Lines with Slopes x and y

Sum of Powers

Adding Complex Numbers

Multiplying Complex Numbers

Complex Number to a Real Power

Permutation

Combination (with duplicating X and Y stack values)

Speed of Sound Approximation (in meters per second)

Finance: Present Value Annuity Factor (including setting N and I% with monthly payments)

Distance Between Two Points (x,y) and (z,t)

Horizontal Curve


When the HP 67 is Turned Off


* All memory is cleared

* The display setting is reset to FIX, DSP 2 (display 2 digits)

* The angle setting is reset to Degrees


Notes


* The number format and the number of decimal points displayed are set separately. For format, the HP 67 offers fixed (FIX), scientific notation (SCI), and engineering format (ENG). For this calculator, do not enter a number after FIX, SCI, or ENG. Setting the number of digits require the use of the display (DSP) key. For instance, if I want to set the HP 67 to fixed setting with 4 decimal places, the keystroke sequence required would be [ f ] (FIX) [DSP] [ 4 ].


* It takes getting used to use a shift key [ h ] before swap (x<>y) and roll down (R↓). Usually they are primary key functions.


* The card reader did not operate, but for machines that are now 50 years old, it's understandable because they do break down. If I get it repaired, I'm leaving it to the professionals.


* There are no internal guard digits. The HP 67, as it seems to be the case for the entire Classic series and possibly later series such as the Voyagers, carries out calculations to fit the 10 digit screen and that's it.


Example:


Set FIX, DSP 9.


2 √ 1.41 - 100 ×


Result:

HP 67 (DSP 9): 0.421356200

HP 45 (FIX 9): 0.421356200

HP 15C CE (FIX 9): 0.421356200

HP 42S, original (ALL): 0.421356237



* This is the only calculator I know that stores the six statistical sum results in secondary registers. I'll have to remember to do the P<>S command first. In later models the registers are not split in this fashion, and that I am grateful for.


* The display is nice, clean, and I do get a small thrill from working with red LED displays.


* There is also a learning curve when all of the shifted functions are listed BELOW the primary keys:

[ primary function ]

        h (black)

g (gold) b (blue)



It's a classic for a reason and I love it. The keyboard is clean and the keys are responsive.


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.

Sunday, August 24, 2025

HP 20S: Acoustics Programs

HP 20S: Acoustics Programs


Program A: Speed of Sound in Dry Air


cs = 20.05 × √(273.15 + T°C)


Code:

01: 61, 41, A: LBL A

02: 75: +

03: 2: 2

04: 7: 7

05: 3: 3

06: 73: .

07: 1: 1

08: 5: 5

09: 74: =

10: 11: √

11: 55: ×

12: 2: 2

13: 0: 0

14: 73: .

15: 0: 0

16: 5: 5

17: 74: =

18: 61, 25: RTN



Program B: Mersenne's Law: Fundamental Frequency



f0 = √(F ÷ µ) ÷ (2 × L)

F: force (N)

µ: mass per unit length (kg/m)

L: string length (m)

f0: fundamental frequency (Hz)

(Marshall, pg. 19)



Store before running:

R1: force

R2: µ

R3: L



Code (continuing from the previous section):

19: 61, 41, b: LBL B

20: 33: (

21: 22, 1: RCL 1

22: 45: ÷

23: 22, 2: RCL 2

24: 34: )

25: 11: √

26: 45: ÷

27: 33: (

28: 2: 2

29: 55: ×

30: 22, 3: RCL 3

31: 34: )

32: 74: =

33: 61, 26: RTN



Program C: Standing Wavelength in an Open Pipe for the 1st through 5th Harmonic



λ = 2 × L ÷ n

L: length of the pipe

n: nth harmonic (positive integer)

(Marshall, pg. 21)



Code (continuing from the previous section):

34: 61, 41, C: LBL C

35: 21, 1: STO 1

36: 1: 1

37: 21, 2: STO 2

38: 61, 41, 3: LBL 3

39: 2: 2

40: 55: ×

41: 22, 1: RCL 1

42: 45: ÷

43: 22, 2: RCL 2

44: 74: =

45: 26: R/S

46: 1: 1

47: 21, 75, 2: STO+ 2

48: 22, 2: RCL 2

49: 31: INPUT

50: 5: 5

51: 61, 42: x≤y?

52: 51, 41, 3: GTO 3

53: 61, 26: RTN



Program D: Finding the perfect length and height for recording studios given the width.



Length = W × φ (stored in R1)

Width = W (stored in R2)

Height = W ÷ φ (stored in R3)

φ = (1 + √5) ÷ 2

(Marshall, pg. 34)



Code (continuing from the previous section):

54: 61, 41, d: LBL D

55: 21, 1: STO 1

56: 22, 2: STO 2

57: STO 3: STO 3

58: 33: (

59: 1: 1

60: 75: +

61: 5: 5

62: 11: √

63: 34: )

64: 45: ÷

65: 2: 2

66: 74: =

67: 21, 55, 1: STO× 1

68: 21, 45, 3: STO÷ 3

69: 22, 1: RCL 1

70: 26: R/S

71: 22, 2: RCL 2

72: 26: R/S

73: 22, 3: RCL 3

74: 61, 26: RTN


HP 20S - The Complete Code:

01: 61, 41, A: LBL A

02: 75: +

03: 2: 2

04: 7: 7

05: 3: 3

06: 73: .

07: 1: 1

08: 5: 5

09: 74: =

10: 11: √

11: 55: ×

12: 2: 2

13: 0: 0

14: 73: .

15: 0: 0

16: 5: 5

17: 74: =

18: 61, 25: RTN

19: 61, 41, b: LBL B

20: 33: (

21: 22, 1: RCL 1

22: 45: ÷

23: 22, 2: RCL 2

24: 34: )

25: 11: √

26: 45: ÷

27: 33: (

28: 2: 2

29: 55: ×

30: 22, 3: RCL 3

31: 34: )

32: 74: =

33: 61, 26: RTN

34: 61, 41, C: LBL C

35: 21, 1: STO 1

36: 1: 1

37: 21, 2: STO 2

38: 61, 41, 3: LBL 3

39: 2: 2

40: 55: ×

41: 22, 1: RCL 1

42: 45: ÷

43: 22, 2: RCL 2

44: 74: =

45: 26: R/S

46: 1: 1

47: 21, 75, 2: STO+ 2

48: 22, 2: RCL 2

49: 31: INPUT

50: 5: 5

51: 61, 42: x≤y?

52: 51, 41, 3: GTO 3

53: 61, 26: RTN

54: 61, 41, d: LBL D

55: 21, 1: STO 1

56: 22, 2: STO 2

57: STO 3: STO 3

58: 33: (

59: 1: 1

60: 75: +

61: 5: 5

62: 11: √

63: 34: )

64: 45: ÷

65: 2: 2

66: 74: =

67: 21, 55, 1: STO× 1

68: 21, 45, 3: STO÷ 3

69: 22, 1: RCL 1

70: 26: R/S

71: 22, 2: RCL 2

72: 26: R/S

73: 22, 3: RCL 3

74: 61, 26: RTN


Examples


LBL A:

Input: T = 0°C: Speed of sound: 331.371367011 m/s

Input: T = 10°C (50°F): Speed of sound: 337.82583835 m/s

Input: T = 26.66666667 (80°F) C: Speed of sound: 347.170058532 m/s



LBL B:

R1: 45 N, R2: 0.008 kg, R3: 0.06 m; f: 625 Hz

R1: 3 N, R2: 0.006 kg, R3: 0.058 m; f: 192.764480819 Hz



LBL C:

Open ended pipe length: 1.2 m

The wavelengths for the 1st, 2nd, 3rd, 4th, and 5th harmonics respectively:

2.4, 1.2, 0.8, 0.6, 0.48

Open ended pipe length: 0.059 m

The wavelengths for the 1st, 2nd, 3rd, 4th, and 5th harmonics respectively:

0.118, 0.059, 3.933333333E-2, 0.0295, 0.0236



LBL D:

Width: 12 ft; Length: 19.416407865 ft, Height: 7.416407865 ft

Width: 18 ft 6 in = 18.5 ft; Length: 29.9336287919 ft, 11.4336287919 ft



Source

Marshall, Steve. Acoustics: The Art of Sound. Wooden Books, LLC. San Rafael, California. 2023. ISBN 978-1-952178-33-7


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.

Sunday, April 13, 2025

Spotlight: Commodore P50

Spotlight: Commodore P50


Quick Facts



Model: P50

Company: Commodore

Timeline: 1978

Type: Scientific, Programming

Memory: 24 Steps

Order of Operations? No

Battery: 1 x 9-volt battery

Memory Registers: 1

Screen: 8 digits, red LED lights










Manual: www.wass.net/manuals/Commodore%20P50.pdf

From Kate Wasserman, Ph. D.’s website: https://www.wass.net/


This is my first Commodore calculator. The purchase included the calculator a manual, which is available from Kate Wasserman’s website above.



Calculating With the P50


Even though the P50 is a larger sized calculator, the calculator feels light weight. The keys are a pleasure to press.


The set of the P50’s functions is a set of basic of scientific calculators:


* Arithmetic functions

* 1/x, x^2, √x. The power function is missing.

* Logarithmic and exponential functions: log, 10^x, ln, e^x

* Trigonometric Functions: sin, cos, tan, arcsin, arccos, arctan, π key.

* Factorial of positive integer: [ n! ]

* Integer part: [ INT ]

* Memory keys: store, recall, product, sum, exchange. We only get one memory register on the P50.


Every function is a primary key except the inverse the inverse trigonometric functions, which are accessed by the [ arc ] key first.


The P50 operates in Chain mode. That is, operations happen in the order of the keys pressed, without regard to the order of operations.


Example:

9 [ × ] 7 [ + ] 8 [ = ] returns 71.

8 [ + ] 9 [ × ] 7 [ = ] returns 119.


There are no parenthesis keys, hence for more complex calculations, the use of the memory key is needed.



Powers and Roots


The P50 is missing the power function. The manual suggests that powers are calculated by the following keystroke sequence:


y^x: y [ ln ] [ × ] x [ = ] [ e^x ]

y^(1/x): y [ ln ] [ × ] x [ 1/x ] [ = ] [ e^x ]


Alternatively:

y^x: y [ log ] [ × ] x [ = ] [ 10^x ]

y^(1/x): y [ log ] [ × ] x [ 1/x ] [ = ] [ 10^x ]


Example:

5^8: 5 [ ln ] [ × ] 8 [ = ] [ e^x ]; returns 390,625

5^(1/8): 5 [ ln ] [ × ] 8 [ 1/x ] [ = ] [ e^x ] returns 1.2228445.


Other function sequences:


Absolute Value, abs(x): [ x^2 ] [ √x ]

4th Power, x^4: [ x^2 ] [ x^2 ]

Cube, x^3: [ STO ] [ x^2 ] [ x^2 ] [ ÷ ] [ RCL ] [ = ] (memory is used)

Sign Function, x ≠ 0, sgn(x): [ STO ] [ x^2 ] [ √x ] [ ÷ ] [ RCL [ = ] (memory is used)

Fraction Part, frac(x): [ STO ] [ - ] [ RCL ] [ INT ] [ = ] (memory is used)


Programming


The P50 has a 24-step capacity. There are no merged keystrokes with exceptions:


* The arcsin, arccos, and arctan key sequences ( [ arc ] [ sin ], [ arc ] [ cos ], [ arc ] [ tan ]) are merged.

* The [ GOTO ] key is followed by a two digit address. In this case any steps 0 through 9 are preceded by a zero (00 -09).


The low amount of programming steps and the one memory register to work with, the P50 programming module is good for short, quick repeated calculations. The programming keys available are:


[ lrn ]: Learn/(Run) Mode Toggle. In run mode you are only shown the step number and nothing else.


[ R/S ]: Run/Stop

[ SSTP ]: Single Step key. However, it only works in run mode, executing program steps one step at a time. This is the most annoying quirk of the P50, almost making it programming in the blind calculator. There are no key codes with each step, and they really should be.

[ GOTO ] ##: Directs the P50 to go to step 00-23. The two digit number after a GOTO counts as one step.


There are three skip functions. If the test is true, the program either:

* Skips the next step or

* Skips the next two steps if the step that follows the test is a GOTO.


[ SKZ ]: Skip if the number in the display is zero. (skip if x = 0)

[ SKN ]: Skip if the number in the display is negative. (skip if x < 0)

[ SKP ]: Skip if the number in the display is positive or zero. (skip if x ≥ 0)


In order for the program to stop and display results and reset for the next calculation, we need the following sequence of steps:

R/S

GTO 00


Otherwise, the program could run unintentionally forever.


There is no clear program button, but programs are not kept when the P50 is turned off.  


P50: Sample Programs


Round to the nearest hundredths (2 decimal places)


×

1

0

0

+

.

5

INT

÷

1

0

0

=

R/S

GTO

00



Examples:

36.728 → 36.73

54.616 → 54.62

40.303 → 40.30 (display shows 40.3)


Permutation


nPr = n! / (n – r)!


STO

-

R/S

n!

1/x

×

RCL

n!

=

R/S

GTO

00


To Run: (GTO 00): n R/S r R/S nPr


Examples:


n = 20, p = 8: 5.0791104 E09 (5,079,110,400)

n = 12, p = 6: 665,280

n = 13, p = 7: 8,648,640


Volume of a Sphere


V = 4 * π * r^3 / 3


STO

x^2

x^2

÷

RCL

×

π

×

4

÷

3

=

R/S

GTO

00


Examples:

r = 11.1: 5,728.7193

r = 6: 904.77868

r = 10: 4,188.7902


Pseudo Random Number Generator


#_i = frac( (π + #_i) ^ 5) = M – int (M) (where M = e^( 5 * ln (#_i + π))


+

π

=

ln

×

5

=

e^x

-

INT

=

R/S

GTO

00


To run: seed R/S, R/S, R/S, ….


Examples:

0.552 → 0.4561281 → 0.7501096 → 0.6846062

0.838 → 0.1437699 → 0.7511575 → 0.8871519



Modulus of Positive Numbers


a > 0, b > 0, a mod b = a – int(a / b) * b


÷

R/S

STO

=

-

INT

×

RCL

=

R/S

GTO

00


To run: a R/S b R/S result


Examples:

19 mod 7 = 5

288 mod 17 = 16


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. 



Classic RPN Stack Operations

  Classic RPN Stack Operations Starting Stack: T:  d Z:  c Y:  b X:  a OVER :   Copies b to the Z and X stacks, while leaving ...