13–2
Programming
Techniques
File name 33s-English-Manual-040130-Publication(Edition 2).doc Page : 388
Printed Date : 2004/1/30 Size : 13.7 x 21.2 cm
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:
1
Program execution branches from this line to
the line marked
1
("from 1").
1
Program execution branches from a line
marked
1
("to 1") to this line.
Starts
here.
1
Calls subroutine Q.
2
Returns here.
Starts D again.
1
Starts subroutine.
.
.
.
2
Returns to routine D.
Содержание 33S
Страница 1: ... HP 33s scientific calculator user s manual H HP Part number F2216A 90020 Printed in China Edition 2 ...
Страница 14: ......
Страница 15: ...Part 1 Basic Operation ...
Страница 16: ......
Страница 56: ......
Страница 64: ......
Страница 82: ......
Страница 92: ......
Страница 122: ......
Страница 137: ...Operations with Complex Numbers 9 7 c Ù Adds L1 L2 L3 Converts vector back to polar form displays r θ ...
Страница 138: ......
Страница 157: ...Part 2 Programming ...
Страница 158: ......
Страница 184: ......
Страница 210: ......
Страница 222: ......
Страница 255: ...Mathematics Programs 15 33 y y x x m n New coordinate system Old coordinate system 0 0 x P u y v θ ...
Страница 293: ...Part 3 Appendixes and Reference ...
Страница 294: ......
Страница 324: ......
Страница 348: ......