RPL Programming 1-29
Here is a stack diagram and program listing for TORSV.
Level 2 Level 1
"
Level 1
a b
"
volume
Pro
ram: Comments:
"!
#!$!%!
"!
!
$!%!:LKDB!
%!$!0!.!a!,!
»
Creates local variables a and b.
Starts a program as the defining
procedure.
Puts the numbers stored in a and b
on the stack, then calls TORSA
with those arguments.
Completes the volume calculation
using the surface area.
Ends the defining procedure.
»
`
O TORSV K
Puts the program on the stack.
Stores the program in TORSV.
Now use TORSV to calculate the volume of a torus of inner radius a = 6 and outer radius b = 8.
6 ` 8 J %TORSV%
Single-Stepping through a Program
It's easier to understand how a program works if you execute it step by step, observing the effect of each step.
Doing this can help you debug your own programs or understand programs written by others.
To single-step from the start of a program:
1. Put the program or program name in level 1 ( or the command line).
2. Press !°LL%RUN% %DBUG% to start and immediately suspend execution. ;E: appears in the status
area.
3. Take any action:
! To see the next program step displayed in the status area and then executed, press %SST%.
! To display but not execute the next one or two program steps, press %NEXT%.
! To continue with normal execution, press !=.
! To abandon further execution, press %KILL%.
4. Repeat the previous step as desired.
To turn off the HALT annunciator at any time:
! Press !°LL %RUN% %KILL%.