One of the disappointing aspects of the Atari Computer System is its lack of user-oriented messages. Particularly disturbing is the error message, or should I say error number? It stops and tells you
What? Where did I put my manual? You then search through your desk, find the manual, flip pages until you hit the error messages, and look up number 138. If you have a disk system, the following program will do all the work for you, as well as offer you several options for continuing program execution, (Non-disk users will also find several aspects of the program suitable for use without a disk).
Here's what the program does for you each time an error is encountered:
- It reports to you that an error was encountered and gives you the error number and the line number where the error was encountered.
- If you have an error messages diskette in drive 1 it will next print out an error message in plain English, telling you what went wrong and possibly how to correct it. (Without a disk you won't get this message but all the rest of the program works fine).
- It offers you the choice of ending program execution or of continuing in one of three ways:
- continue with the line on which the error was encountered.
- continue with the line immediately following the error line.
- continue with the LINK line (equivalent to the TRAP function).
That is the system in a nutshell. It is structured to be of general use and should be modified to your particular needs. To aid in this, I will explain how the program works.
LINE 0 is the required DIM statements for string variables used in the system.
LINE 1 sets the TRAP to 32500 - the start of the reporting system. NOTE: The TRAP command cannot be used in your program. Instead, simply set the variable LINK to the line you normally would have used for TRAP. Example:
250 TRAP 5000
should be entered as:
250 LINK = 5000
LINE 32500 finds the line number in which the error occurred. It also finds the error number.
LINE 32510 prints the error number and the line at which it occurred.
LINES 32520-32530 assigns a file name to be used to recover the appropriate error message from disk.
LINE 32540 sets a TRAP to report a default message if an error occurs while retrieving the error message (for instance, if your disk is turned off, or if you have no disk).
LINE 32550 opens the appropriate disk file and, if successful, skips over the default message.
LINE 32570 gets the error message from disk.
LINE 32580 jumps to the subroutine to find what the next line after the error line is. It also resets the TRAP for future operation.
LINES 32581-32587 print your options.
LINE 32588 ask for your choice.
LINE 32589 clears the screen.
LINE 32590 turns off the TRAP and ENDs if you hit "S" (for STOP).
LINES 32591-32593 check for other legal choices and go to the appropriate line.
LINES 32599 jumps back to print your options once again if an illegal entry is detected.
LINE 32600 starts the routine to find the next line number after the error line. The variable NXLINE is initialized.
LINE 32610 finds the first line number in the program.
LINES 32620-32660 finds the line number by starting at the first line and checking one line at a time until it hits the error line. The next line is then used for the next line number.
LINE 32699 Returns back to the line calling this routine.
Program 1. Error Report Routine
In order to fully use the Error Report System you must have a diskette with all the error messages correctly recorded on it. The following program can be used to create your own custom-made error messages master diskette. It simply asks you for an error number and its matching message. The message is then written to disk under the appropriate error number file.
Program 2. Error Report Writer
Possible System Uses or Modifications
The error reporting system can be used while developing your programs, providing you with messages during your next run as well as with several restart options. The system is presently under manual control after an error is encountered. This of course can be automated to provide error trapping AND error correction.
For example, your program may provide a hardcopy printout of the program results. If an error #138 is encountered, you may wish to print a message on the screen such as "Please turn on the printer" and then go back to the offending line. Print a cursor-up after the message and you can loop until the printer is turned on, after which the program immediately continues executing.
You may also be able to use pieces of this system in your own programs. For example, lines 32520-32530 show how your program can dynamically create its own disk file name, based on the value of variables.
Return to Table of Contents | Previous Section | Next Section