
hp calculators
HP 35s Converting programs to line number addressing
hp calculators - 2 - HP 35s Converting programs to line number addressing - Version 1.0
Programming the HP 35s
Doing a simple calculation once on the HP 35s is easy. Doing the same calculation many times, or doing a complicated
calculation, takes longer. It can be better to store all the steps needed for the calculation in a program. A program is a
set of instructions, stored all together. Once it is written, it can be tested to see if it works correctly. Then it can be used
many times, without the need to press every key of the calculation each time.
A simple program is just a set of keystrokes stored so that they can be carried out with one key. The HP 35s provides
many commands to let programs do more, for example stop and ask for input, or show an intermediate result.
This training aid concentrates on converting programs originally written using labels, such as programs written for the
HP33s, to using line number addressing, as is available on the HP 35s calculator.
Converting programs from labels to line numbers
The HP 35s has 26 labels for use to define programs or transfers to locations within programs. Unlike the HP 33s, the
HP 35s also includes the ability to transfer execution to specific line numbers within one of the 26 labels. This allows for
a much greater utilization of program memory without using labels excessively.
Suppose you have the program below and wish to convert it to the HP35s. This program will pause to display the
intermediate values, given a whole number input, as it performs the steps involved in Ulam’s Conjecture. Will the number
eventually converge to one or not? (Note: There has been absolutely no attempt to optimize this program!)
B011 RCL A
B012 3
B013 x
B014 1
B015 +
C001 LBL C
C002 STO A
C003 GTO B
D001 LBL D
D002 RCL A
D003 2
D004 INT÷
D005 GTO C
Label Version
A001 LBL A
A002 STO A
B001 LBL B
B002 PSE
B003 1
B004 x=y?
B005 RTN
B006 x<>y
B007 2
B008 RMDR
B009 x=0?
B010 GTO D
Converting on paper. Given the initial listing, the first suggestion is to make a note next to the first step following each
LBL instruction after the initial label that starts the routine. These would be the PSE after LBL B, the STO A after LBL C,
the RCL A after LBL D. Beside each of these steps, write B, C, and D. These will become the steps that line number
GTOs and XEQs will reference. In the listing below, these steps are BOLD.