Section 8: Subroutines; Gotosubroutine - HP -11C Owner's Handbook Manual

Hide thumbs Also See for HP-11C:
Table of Contents

Advertisement

Section 8
Subroutines
Subroutines In Brief
Often a program contains a certain series of instructions that are
executed several times during a single execution of the program.
When the same set of instructions occurs more than once in a
program, memory space can be conserved by executing the
instructions as a subroutine.
Go To Subroutine
A subroutine is executed using
with the desired alpha or
numeric label address.* A
instruction transfers execution to
the specified label address in the same way as (GTO]. However,
when a
instruction is executed in a running program, a
pending return condition is set in the calculator. When a pending
return condition exists, the first subsequent
(return)
instruction encountered by a running program will cause program
execution to transfer back to the program instruction immediately
following the last [GSB]. Execution then continues sequentially
downward through program memory. (When the
is executed,
the "pending" condition is cleared.) Compare the following
illustrations of a branch and a subroutine.
Branch
(f)(teL)(8]
/
/
TR
(o)
Execution trans-
fers to line 000
and halts.
* A
followed by an alpha label address is an abbreviated key sequence. Refer to
page 78, Abbreviated Key Sequences.
119

Advertisement

Table of Contents
loading

Table of Contents