Section 12: Subroutines184
You can use a specific numeric label (like LBL 10) any number of times in the programs you write. When you branch to that label, the calculator finds the first occurrence of that label in the current program beginning from the present location in the program. Refer to Subroutine Types and Label Searching, page 178, for more information.
However, note that you should use caution when using the same ALPHA label more than one time. Since the HP-41C searches all of program memory from the bottom up for ALPHA labels, only the last occurrence of that label in program memory will ever be found.
After the first execution of a subroutine, the HP-41C ‘‘remembers’’ the location of most numeric labels. Subsequent branches to those labels do not require the time-consuming search. Refer to appendix G for more details about label searching.
When a program is labeled with an ALPHA label, the HP-41C begins searching through all ALPHA labels beginning at the bottom of program memory. If the ALPHA label is not found, the display will show NONEXISTENT.
Beginning with the introduction of this handbook, you have written and executed several programs that relate to the heat loss of a cylindrical water heater. These programs included HEAT, CIRCLE, and AREA. Let’s now bring all of these programs together and form one master program that uses these programs to find the heat loss of the water heater. To begin, make sure all of these programs have been cleared from program memory because you will make minor changes and re-load them. Use CLP and specify the program name to clear them.
You will create three new programs: BTU, AREA and TEMP. BTU is the master program that executes the other programs as subroutines and gives the final answer. AREA computes the area of a cylinder given its height and radius, and TEMP computes the temperature difference between the heater surface and the air around the heater. Since AREA and TEMP are outside the master program, they have ALPHA labels and are terminated with END instructions.
Since you will use PROMPT so many times when you input the following programs, first assign the PROMPT function to the Σ+ key for use in USER mode. Then, each time you wish to insert a PROMPT instruction in a program, simply press Σ+ in USER mode.
Keystrokes Display    
g ASN 
  ASN _    
   
ALPHA PROMPT ALPHA 
  ASN PROMPT _    
   
Σ+ 
  0.0000    
   
USER 
  0.0000