Annunciators for Set Flags

Flags 0, 1, 2, 3 and 4 have annunciators in the display that turn on when the corresponding flag is set. The presence or absence of 0, 1, 2, 3 or 4 lets you know at any time whether any of these five flags is set or not. However, there is no such indication for the status of flags 5 through 11. The statuses of these flags can be determined by executing the FS? instruction from the keyboard. (See "Using Flags" below.)

Using Flags

Pressing ydisplays the FLAGS menu: { } {} { @}

After selecting the function you want, you will be prompted for the flag number (0–11). For example, press y{ } 0 to set flag 0; press y

{} 0 to set flag 10; press y{ } 1 to set flag 11.

FLAGS Menu

Menu Key

Description

 

 

{ } n

Set flag. Sets flag n.

{} n

Clear flag. Clears flag n.

{ @} n

Is flag set? Tests the status of flag n.

 

 

A flag test is a conditional test that affects program execution just as the comparison tests do. The FS? n instruction tests whether the given flag is set. If it is, then the next line in the program is executed. If it is not, then the next line is skipped. This is the "Do if True" rule, illustrated under "Conditional Instructions" earlier in this chapter.

If you test a flag from the keyboard, the calculator will display "& " or "".

It is good practice in a program to make sure that any conditions you will be testing start out in a known state. Current flag settings depend on how they have been left by earlier programs that have been run. You should not assume that any given flag is clear, for instance, and that it will be set only if something in the program sets it. You should make sure of this by clearing the flag before the condition arises that might set it. See the example below.

Programming Techniques 13–11