|
Section 11: Branching and Looping161
|
|
To run the program, first assign it to the TAN
key location in USER mode.
|
|
|
|
Now, run the program:
|
|
|
|
How the program works: When you press ROOT ,
the calculator begins executing the ROOT program starting with line 1.
It executes that instruction and each subsequent instruction in order
until it reaches the GTO 05 in line 11.
|
|
The GTO 05 in line 11 causes the HP-41C to begin
a label seacrh. It searches downward through the program to the
END instruction, then starts at the beginning of
the program (line 0) and searches downward until it find the
LBL 05 in line 4. Notice that the address after
the GTO instruction is a numeric label,
not a line number.
|
|
Execution is transferred to the LBL 05
instruction in line 4 each time the calculator executes the
GTO 05 in line 11. The calculator remains in
this ‘‘loop,’’ continually adding one to the
number in storage register R01 and
displaying the new number and its square root.
|