HP -11C Owner's Handbook Manual page 63

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

Advertisement

122
Section 8: Subroutines
Main Program
Subroutine
001-
[f[tet
013- [f)[LBL)O
'O}0
"
014- (9 )(7]
<7
ons- (isa
"
y
016- [SIN]
/
017-5]
>
018- (@)(Rt™
ee
oo"
ao
<«-——"
(Program assumes
[DEG] trig mode.)
When you press ff] [C
displayed X-register, execution begins with the (LBL
with x, in the Y-register and xq in the
[C) instruction
in line 001. When the (GSB) 0 instruction in line 005 is encountered,
execution transfers to the
0 instruction in line 013 and
calculates y;. If for example, we used a value of 2 for x, and a value
of 3 for xg, here is how the solution would be calculated.
STO]O
(sto
G25)
[Ejo
(4 in
(x2 inRg) (Exchange)
(x2-x, in
Y-reg. x2
Ro)
in X-reg.)
oe
Seah
NS
Ne NO
Ww ewe
we
ie
Keys>
Section 8: Subroutines
123
(GsBjo
f][LBLJO
OE
USt
(Goto
tabelO)
subroutine)
(Begin
(x?)
4)
SIN
ic]
9 )(RTN
CHS
{sinxy)
(x,2—sinx, (Returnto
(—(x4?
=y)
main
—sinx,))
program)
From line 018 execution transfers back to the main program and
continues with the first line after the last
instruction. When
the (GSB) 0 instruction in line 008 is encountered, execution again
transfers to the LBL] 0 instruction in line 013.
=)
so
Do
OH
(Exchange)
(Goto
(Begin
(x2?)
labelO)
Subroutine)

Advertisement

Table of Contents
loading

Table of Contents