Section 11: Branching and Looping161
To run the program, first assign it to the TAN key location in USER mode.
Keystrokes Display    
PRGM 
  0.0000    
   
g ASN 
  ASN _    
   
ALPHA ROOT ALPHA 
  ASN ROOT _    
   
TAN 
  0.000    
  ROOT is assigned to the TAN location.
USER 
  0.0000    
  The HP-41C is placed into USER mode.
Now, run the program:
Keystrokes Display    
ROOT ( TAN
  1.0000    
  The program displays a table of integers of and their square roots and continues until you press R/S from the keyboard or the calculator overflows.
 
  1.0000    
 
 
  2.0000    
 
 
  1.4142    
 
 
  3.0000    
   
 
  1.7321    
   
 
  4.0000    
   
 
  2.0000    
   
 
  5.0000    
   
R/S 
  2.2361    
   
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.