Utility: Error_Exit - HP 9835A Programming Manual

35 series desktop computer assembly development rom
Table of Contents

Advertisement

Errors and Error Processing
191
During the running of production (debugged) routines, errors can be caused by the users of the
routines. For instance, the user may inadvertently assign an argument a value of zero when that
argument is to be used as a divisor within the assembly language routine. You should try to
anticipate these usage errors and program procedures to trap them.
There are many alternatives for actions to take when your routine encounters and traps a usage
error. For example, you may wish to assign a value to a particular return variable, or you may
want to print a warning message, or, perhaps, to correct the value and proceed with the
routine. Another method is to notify the user by issuing a BASIC error message. Such messages
can be issued through the Error_exit utility discussed below.
Of course, you need to tell the users (in the documentation of the routine) what kind of errors
can occur, when they can occur, and what to do about them.
UTILITY:
Error exit
The Error_exit utility provides you with the capability of aborting an assembly language
routine by "creating" a BASIC error. Two types of BASIC errors can be created-
"recoverable", which can be trapped by a BASIC ON ERROR statement; and "non-
recoverable" (or "fatal"), which cannot be trapped.
General Procedure: The utility is given the number of the error to be created. Then the utility
is called with the JSM instruction, but no return is made to the original assembly language
routine from the utility. Instead, the utility uses the information placed on the return stack to
help create the error. The return stack is appropriately "cleaned up" and control is returned
either to the BASIC driver (if the error is non-fatal) or to the operating system (if the error is
fatal).
Special Requirements:
Error numbers are passed to the utility in the A register. The value of
the error number is placed in bits 0-14. Bit 15 is set if the error is to be non-recoverable. If bit
15 is not set, the error will be recoverable. Error numbers 32 762 through 32 767, with bit 15
set, are reserved by the operating system and should not be used.
Calling Procedure:
1.
Load the error number into the A register.
2. Call the utility using the JSM instruction.

Advertisement

Table of Contents
loading

Table of Contents