Section 8: Program Branching and Controls 99
In this way, a program can accommodate two different modes of input,
such as degrees and radians, and make the correct calculation for the
mode chosen. You set a flag if a conversion needs to be made, for
instance, and clear it if no conversion is needed.
Suppose you had an equation requiring temperature input in Kelvin,
although sometimes your data might be in degrees Celsius. You could use
a program with a flag to allow either a Kelvin or Celsius input. In part, such
a program might include:
Keystrokes Display
| ¥
000-
Program mode.
´ b C
001-42,21,13
Start program at “C” for degrees
Celsius.
| " 7
002-43, 5, 7
Flag 7 cleared (=false).
t 1
003- 22 1
´ b Á
004-42,21,14
Start program at “D” for Kelvin.
| F 7
005-43, 4, 7
Flag 7 set (=true).
´ b 1
006-42,21, 1
(Assuming temperature in X-register.)
| ? 7
007-43, 6, 7
Checks for flag 7 (checks for Celsius or
Kelvin input).
t 2
008- 22 2
If set (Kelvin input), goes to a later
routine, skipping the next few
instructions.
2
009- 2
If cleared (Celsius input), adds 273 to
the value in the X-register, since
K = °C + 273.
7 010- 7
3
011- 3
+
012- 40
´ b 2
013-42,21, 2
Calculation continues for both modes.
The System Flags: Flags 8 and 9
Flag 8. Setting flag 8 will activate Complex mode (described in Section
11), turning on the C annunciator. If another method is used to activate
Complex mode, flag 8 will automatically be set. Complex mode is
deactivated only by clearing flag 8; flag 8 is cleared in the same manner
as the other flags.