Section 13: Indirect Operations202
Example: The following program uses two controlled loops to place a number used by TONE (audible tone) function. The program counts from 0 to 9 and controls the first loop using ISG , then counts back to 0 and controls the second loop using DSE .
 
Keystrokes Display    
PRGM 
       
   
g GTO · · 
  00 REG 46    
   
g LBL 
       
   
ALPHA SONG ALPHA 
  01 LBLTSONG    
   
.009 
  02 .009 _    
   
STO 01 
  03 STO 01    
  The first loop control number is stored in register R01.
  04 9 _    
   
STO 02 
  05 STO 02    
  The second loop control number is stored in register R02.
g LBL 01 
  06 LBL 01    
  The beginning of the first loop.
XEQ 
       
   
ALPHA TONE ALPHA 
       
   
g 01 
  07 TONE IND 01    
  TONE uses R01 as an indirect address. The TONE function uses the number in R01 to control the audible tone in the HP-41C.
g ISG 01 
  08 ISG 01    
  Add one to the loop control number in R01. Test loop control number: if it is not greater than 9, execute loop again; if it is greater than 9 skip the next line.
g GTO 01 
  09 GTO 01    
  Loop to LBL 01.
g LBL 02 
  10 LBL 02    
  The beginning of the second loop.
XEQ 
       
   
ALPHA TONE ALPHA 
       
   
g 02 
  11 TONE IND 02    
  TONE uses R02 as an indirect address. The number in R02 controls the audible tone.