Section 9: Program Branching And Controls; The Mechanics; Branching - HP -16C Owner's Handbook Manual

Table of Contents

Advertisement

Section 9
Program Branching and Controls
The branching capabilities of the HP-16C include simple and
conditional branching—in which program execution depends on a
certain condition—and subroutines. The use of the Index register,
which can hold a counter value, greatly enhances the calculator's
branching and looping control.
The Mechanics
Branching
The Go To ([GTO]) Instruction. Simple branching—that is,
unconditional branching—is carried out with the instruction
label. In a running program,
{0 to 9, A to F, (1)} will transfer
execution to the designated program or routine.* (It is not possible
to branch to a line number.) The calculator searches forward in
memory for the indicated label, wrapping around to line 001 and
beyond if necessary.
label can also be used in Run mode (that is, from the
keyboard) to move to a labeled position in program memory. No
execution occurs.
Go To Subroutine ([GSB]). Transfer to a labeled subroutine is
executed by the sequence
label. Program execution auto-
matically transfers back to the main program when a
instruction is encountered." Subroutine execution is described later
in this section (page 94).
*(GTO]
and
(1) are abbreviated key sequences (no
keystroke necessary), as
explained on page 68.
TIf no subroutine return is pending, a
instruction halts execution and returns the
calculator to the top of program memory.
87

Advertisement

Table of Contents
loading

Table of Contents