Download Print this page

HP 35s Instruction Manual page 2

Converting programs to line number addressing
Hide thumbs Also See for HP 35s:

Advertisement

hp calculators
HP 35s Converting programs to line number addressing
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!)
A001
A002
B001
B002
B003
B004
B005
B006
B007
B008
B009
B010
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.
hp calculators
Label Version
LBL A
STO A
LBL B
PSE
1
x=y?
RTN
x<>y
2
RMDR
x=0?
GTO D
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
- 2 -
HP 35s Converting programs to line number addressing - Version 1.0

Advertisement

loading