Usingflags - HP -11C Owner's Handbook Manual

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

Advertisement

116
Section 7: Program Decisions and Control
Using Flags
Like the x:y and x:0 conditional tests, flags give you the capability
to either skip or execute individual lines in program memory.
However, while the x:y and x:0 conditionals function by
comparing values, flags function by telling the calculator status.
That is, if a set flag ([9]
n) instruction is placed in a program
branch, testing that flag elsewhere ([g]
n) can tell the
calculator whether or not that branch has been executed.
Example. The following program closely approximates the
conversion of an input in miles to kilometers ((f] (A]), or the
conversion of an input in kilometers to miles ([f](B]). The calculator
uses the status of flag 0 to decide whether to convert a user input to
kilometers (multiply input by conversion factor) or to miles (divide
input by conversion factor).
Keyin
kilometers.
Start
Y
y
|
Clear flag.
I
Set flag.
n
Place
1.6093
in X-register.
No
Yes
Y
Y
|
Multiply.
|
I
Divide.
|

Advertisement

Table of Contents
loading

Table of Contents