1-26 RPL Programming
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 hp49g+/hp48gII 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 the
hp49g+/hp48gII, there are no display annunciators to indicate that user flags 1 through 5 are
set, like the hp48S-series and hp48G-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.
Example: System Flag. The following program sets an alarm for June 6, 2007 at 5:05 PM. It first tests the
status of system flag -42 (Data Format flag) in a conditional structure and then supplies the alarm date in the
current date format, based on the test result.