SingleStep Operations

Key

Programmable

Description

 

Command

 

 

 

 

!°LL%RUN% :

 

 

 

 

%DBUG%

DBUG

Starts program execution, then suspends it as if HALT were the first

 

 

program command. Takes as its argument the program or program name

 

 

in level 1.

%SST%

 

Executes the next object or command in the suspended program.

%SST°%

 

Same as %SST%, except if the next program step is a subroutine, singlesteps

 

 

to the first step in that subroutine.

%NEXT%

 

Displays the next one or two objects, but does not execute them. The

 

 

display persists until the next keystroke.

%HALT%

HALT

Suspends program execution at the location of the HALT command in

 

 

the program.

%KILL%

KILL

Cancels all suspended programs and turns off the HLT annunciator.

!=

CONT

Resumes execution of a halted program.

 

 

 

Trapping Errors

If you attempt an invalid operation from the keyboard, the operation is not executed and an error message appears. For example, if you execute + with a vector and a real number on the stack, the calculator returns the message + Error: Bad Argument Type and returns the arguments to the stack (if Last Arguments is enabled).

In a program, the same thing happens, but program execution is also aborted. If you anticipate error conditions, your program can process them without interrupting execution.

For simple programs, you can run the program again if it stops with an error. For other programs, you can design them to trap errors and continue executing. You can also create userdefined errors to trap certain conditions in programs. The error trapping commands are located in the PRG ERROR menu.

Causing and Analyzing Errors

Many conditions are automatically recognized by the calculator as error conditions — and they’re automatically treated as errors in programs.

You can also define conditions that cause errors. You can cause a userdefined error (with a userdefined error message)

or you can cause a builtin error. Normally, you’ ll include a conditional or loop structure with a test for the error condition — and if it occurs, you’ll cause the userdefined or builtin error to occur.

To cause a userdefined error to occur in a program :

1.Enter a string (with "" delimiters) containing the desired error message.

2.Enter the DOERR command (PRG ERROR menu).

RPL Programming 133

Page 57
Image 57
HP 48gII Graphing, 50g Graphing manual Trapping Errors, Causing and Analyzing Errors, SingleStep Operations, Ll%Run%