HP 33s hp 33s_user's manual_English_E_HDPM20PIE56.pdf - Page 186
Calling Subroutines (XEQ, RTN), subroutine, called from, returns
UPC - 082916001456
View all HP 33s manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 186 highlights
Calling Subroutines (XEQ, RTN) A subroutine is a routine that is called from (executed by) another routine and returns to that same routine when the subroutine is finished. The subroutine must start with a LBL and end with a RTN. A subroutine is itself a routine, and it can call other subroutines. XEQ must branch to a label (LBL) for the subroutine. (It cannot branch to a line number.) At the very next RTN encountered, program execution returns to the line after the originating XEQ. For example, routine Q in the "Normal and Inverse-Normal Distributions" program in chapter 16 is a subroutine (to calculate Q(x)) that is called from routine D by line Routine Q ends with a RTN instruction that sends program execution back to routine D (to store and display the result) at line D0004. See the flow diagrams below. The flow diagrams in this chapter use this notation: M Program execution branches from this line to the line marked M ("from 1"). M Program execution branches from a line marked M ("to 1") to this line. M N ! M N Starts here. Calls subroutine Q. Returns here. Starts D again. Starts subroutine. Returns to routine D. 13-2 Programming Techniques