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.

Example:

Program:

Comments:

 

 

«

 

IF

Tests the status of flag –42, the Date

-42 FC?

Format flag.

THEN

If flag –42 is clear, supplies the date in

6.152007

month/day/year format.

ELSE

If flag –42 is set, supplies the date in

15.062007

day.month.year format.

END

Ends the conditional.

17.05 "TEST COMPLETE"

Sets the alarm: 17.05 is the alarm time

3 →LIST STOALARM

and “TEST COMPLETE” is the

 

alarm message.

»

 

 

 

Example: User Flag. The following program returns either the fractional or integer part of the number in level 1, depending on the state of user flag 10.

Program:

Comments:

 

 

 

«

 

 

IF

 

Starts the conditional.

10

FS?

Tests the status of user flag 10.

THEN

If flag 10 is set, returns the integer part.

IP

 

 

ELSE

If flag 10 is clear, returns the fractional part.

FP

 

 

END

 

Ends the conditional.

»

 

 

 

 

 

To use this program, you enter a number, either set flag 10 (to get the integer part) or clear flag 10 (to get the fractional part), then run the program.

Recalling and Storing the Flag States

If you have a program that changes the state of a flag during execution, you may want it to save and restore original flag states.

The RCLF (recall flags) and STOF (store flags) commands let you recall and store the states of the calculator’s flags. For these commands, a 64-bit binary integer represents the states of 64 flags — each 0 bit corresponds to a flag that’s clear, each 1 bit corresponds to a flag that’s set. The rightmost (least significant) bit corresponds to system flag –1 or user flag 1 for the lower groups and system flag –65 or user flag 65 for the upper groups.

1-28 RPL Programming