Download Print this page

HP 35s User Manual page 2

Scientific calculator - programming using line numbers
Hide thumbs Also See for 35s:

Advertisement

hp calculators
HP 35s Programming using line numbers
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 simple programming; it also shows a few of the more advanced programming commands.
Using line numbers rather than labels
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.
For example, the program line below illustrates how a goto instruction can now branch to a line number within a lettered
label. Step B010 tests whether the value in the X register is less than the value in the Y register. If true, step B011
transfers execution to step 018 of label B. On the HP 33s, step B011 would have required a goto instruction pointing to a
step with one of the 26 labels.
In the past, using line number GTO and XEQ instructions in programs was difficult if changes were made to the program
after these instructions were entered, since the program steps would have changed but the transfer instructions would
still have pointed at the old line numbers, making the program work incorrectly.
The HP 35s removes this constraint. When a program containing line number GTO or XEQ instructions has a step added
or deleted, the HP 35s dynamically changes the lines referred to by these instructions to point at the correct location.
For example, if in the program shown in figure 1 above, another step were added before step B010 such as an ABS
instruction, steps B010 would become step B011 and step B011 would become step B012. More importantly, the HP 35s
would change the new step B012's GTO instruction to continue pointing at the same location within the program – step
B019 in this instance. This is shown in figure 2 below.
This dynamic renumbering allows for the use of line numbers in GTO or XEQ instructions without the drawbacks earlier,
less-advanced calculators may have had.
hp calculators
- 2 -
HP 35s Programming using line numbers - Version 1.0
Figure 1
Figure 2

Advertisement

loading