To recall the current flag states:

Execute RCLF (!°L %MODES% %FLAG% L%RCLF% ).

RCLF returns a list containing four 64bit binary i ntegers representing the current states of the lower and upper groups of system and user flags:

{#nsystemlower #nuserlower #nsystemupper #nuserupper }

To change the current flag states:

1.Enter the flagstate argument — see below

2.Execute STOF (!°L %MODES% %FLAG% L%STOF% ).

STOF sets the current states of flags based on the flagstate argument:

#ns

Changes the states of only the system flags.

{ #nslower #nulower #nsupper #nuupper }

Changes the states of the system and user flags.

Example: The program PRESERVE on page 26 uses RCLF and STOF.

Using Subroutines

Because a program is itself an object, it can be used in another program as a subroutine. When program B is used by program A, program A calls program B, and program B is a subroutine in program A.

Example: The program TORSA calculates the surface area of a torus of inner radius a and outer radius b. TORSA is used as a subroutine in a second program TORSV, which calculates the volume of a torus.

The surface area and volume are calculated by

A = π

2

( b

2

a

2

)

V =

1

π

2

(b

2

a

2

)( b a)

 

 

 

--

 

 

 

 

 

 

 

 

 

 

 

4

 

 

 

 

 

 

 

(The quantity π2(b2 a2) in the second equation is the surface area of a torus calculated by TORSA.) Here are the stack diagram and program listing for TORSA.

Level 2

Level 1

Level 1

 

 

 

 

a

b

surface area

 

 

 

 

RPL Programming 129

Page 53
Image 53
HP 48gII Graphing manual Using Subroutines, To recall the current flag states, Execute Rclf !L %MODES% %FLAG% L%RCLF%