Reference Guide
RPL Programming 1-27
Using Flags
You can use flags to control calculator behavior and program execution. You can think of a flag as a switch that is
either on (set) or off (clear). You can test a flag’s state within a conditional or loop structure to make a decision.
Because certain flags have unique meanings for the calculator, flag tests expand a program’s decision-making
capabilities beyond that available with comparison and logical functions.
Types of Flags
The calculator has two types of flags:
System flags.
Flags –1 through –128. These flags have predefined meanings for the calculator.
User flags.
Flags 1 through 128. User flags are, for the most part, not used by any built-in operations. What they
mean depends entirely on how the program uses them.
Appendix C lists the 128 system flags and their definitions. For example, system flag –40 controls the clock display
— when this flag is clear (the default state), the clock is not displayed — when this flag is set, the clock is displayed.
(When you press
%CLK%
in the
H%MISC%
menu, you are setting or clearing flag –40.)
Note that for these calculators, there are no display annunciators to indicate that user flags 1 through 5 are set, like
the older HP 48S-series and HP 48G-series calculators.
Setting, Clearing, and Testing Flags
Flag commands take a flag number from the stack — an integer 1 through 128 (for user flags) or –1 through –128
(for system flags).
To set, clear, or test a flag:
1.
Enter the flag number (positive or negative).
2.
Execute the flag command — see the table below.
Flag Commands
Key Programmable
Command
Description
!°%TEST%
LL
:
%SF%
SF Sets the flag.
%CF%
CF Clears the flag.
%FS?%
FS?
Returns 1. (true) if the flag is set, or
0. (false) if the flag is clear.
%FC?%
FC? Returns 1. (true) if the flag is clear,
or 0. (false) if the flag is set.
%FS?C%
FS?C Tests the flag (returns true if the
flag is set), then clears the flag.
%FC?C%
FC?C Tests the flag (returns true if the
flag is clear), then clears the flag.