Classic Computer Magazine Archive HI-RES VOL. 1, NO. 2 / JANUARY 1984 / PAGE 32


Oh Those ?$*&
Error Messages



Last issue I discussed error codes generated by Basic. This installment will show you some of the error codes that can be generated when using a peripheral device, such as a printer, a disk drive, or program recorder.

Remember that when an error code is generated, your Atari Home Computer stores it at decimal location 195. Generally, the error code number will remain in location 195 until a new error occurs. With this information, you can use traps to branch your Basic program when errors occur.

Error Code 19: Load Program Too Long

Your computer is telling you that the program being loaded is too large for available memory. If you are sure that you have enough memory in your machine, try resetting the memory modules.

Error Code 20: Device Number Larger Than 7 or Equal to 0

You have tried to specify a peripheral device that your computer is not prepared to handle. Generally, the Atari will not accept a peripheral device numbered larger than seven or less than or equal to zero. For instance: Open #9,8,0,"D:... "will give you Error Code 20.

Error Code 21: Load File Error

Read the Atari Basic Reference Manual for definitions of the Basic commands Load and Enter. This error code is telling you that you tried to load a Basic program that was "untokenized" (Listed to the disk drive instead of saved). If you get an Error Code 21 when you type Load "D:Filename" then try Enter "D: Filename".

This error also occurs if you try to load a file that is written in machine language. If you try to enter that file, you will get a different error.

There are no Basic or peripheral-generated error code numbers between 21 and 128.

Many of the following errors refer to the use of IOCBs. IOCB is an acronym for Input/Output Control Block. The IOCB number notifies your computer that you are planning an I/O operation and will use a particular buffer (previously specified by Atari Basic.

Error Code 128: Break Abort

This error code shows up when you press the break key when using Save, Load, List, Enter, or using any of the File Management commands from the Disk Operating System. Your computer is telling you (as if you didn't know) that you have pressed the Break key.

Error Code 129: IOCB Already Open

Now we are getting into the meaty peripheral device error codes. A Code 129 is telling you that you are attempting to open an IOCB that is already open. Perhaps you have opened a file at the beginning of a For/Next loop and at the next reiteration your computer has attempted to open it again.

Or, you have opened a file using one IOCB and are now attempting to open a second file using the same IOCB.

This error can be trapped and used in your program.

Error Code 130: Nonexistent Device Specified

Each peripheral device that you hang on your Atari needs a program called a handler. Some handlers are contained within the computer's operating system, such as the program recorder handler and the printer handler. Others must be supplied to the computer. (The handler for the Atari 850 Interface Module is downloaded from the Atari 850 Interface Module by the AUTORUN.SYS file contained on the DOS 2 Master Diskette.)

With Error Code 130, your computer is telling you that you have attempted to open a peripheral device that contains no handler.

This error code will also occur if you attempt to open a file without specifying a device, such as Open "Filename, instead of Open "D: Filename"

Error Code 131: IOCB Write-Only

Somewhere in your program there is a statement something like: Open # l,8,0,"D:... " Somewhere else (such as where your Error 131 happened) there is a statement something like: Input # 1, or Get # I ...

In the first statement, you have told your computer that you want to open IOCB #1 for write only I/O. In the second statement, you have attempted to read data from that IOCB, and your computer has rejected that plan.

This error can be corrected by changing either your Open statement or changing Input or Get to Print or Put.

Error Code 132: Invalid Command

There is a portion of the Atari Operating System called the Central Input/Output (CIO) subsystem. It is the CIO's job to handle I/O. When your computer is given an I/O command, a number is sent to the CIO. If the number is less than or equal to two, then this error code is generated.

If the number is between three and 13, then it is a standard I/O command. If it is more than 13, it is a special command. If the CIO tries to process a special command and the peripheral device doesn't recognize it, this also will generate an Error 132.

These CIO command numbers are the same as the Basic XIO command numbers, which are explained more fully in the Atari Disk Operating System Reference Manual.

Error Code 133: Device or File Not Open

Your computer is telling you that you are trying to write or read to a file or peripheral device you have failed to Open first. This is a particularly handy error to employ in programs using I/0. If the device is not open for I/0, then the error can be Trapped. After that the device can be Opened.

Error Code 134: Bad IOCB Number

Of the eight IOCBs available in Atari Basic, the programmer is allowed to use seven of them (IOCBs 1 to 7). This error code is telling you that you have attempted to use illegal IOCB number. Check your program.

Note: Each time you use or change graphic modes, Basic uses IOCB #6. If your program has LPrint statements, Basic uses IOCB #7. Be careful how you use these IOCBs.

Error Code 135: IOCB Read Only Error

This is the opposite of Error Code 131.

You have attempted to write to a device or file that is open for read only.

Error Code 135 can be used to check to see if a file exists before writing data to it.

10 OPEN #1,4,0,"D:TEST"
20 TRAP 60:INPUT #1;A$
50 CLOSE #1:GOT0 100
70 IF PEEK (195)=135 THEN OPEN 1,8,0,"D:TEST":GOTO 20
80 IF PEEK (195)=130 THEN OPEN # 1,9,0,"D:TEST":GOTO 20
100 ... REST OF PROGRAM...

Error Code 136: End-Of-File

Error Code 136 is how your computer tells you it has reached the end-of-file. It is one of the more commonly used errors when reading data from files. For example:

10 OPEN # 1,4,0,"D:TEST":TRAP 70
40 INPUT#1;A$
80 CLOSE #1

Line 10 opens the file and sets the trap. Line 20 sets up an endless For/ Next loop that can only be broken when an error happens. Line 40 gets the data (A$) from the file and line 50 prints it to your screen. Line 60 sends the program back to line 20 for the next reiteration. When the end-of-file is reached Error Code 136 is generated, the Trap is sprung, and the program branches to line 70, where the last part of the file is printed. Line 80 closes the IOCB.

Error Code 137: Truncated Record

This error code means that you are attempting to read a record that is larger than 119 bytes (or characters). It can happen when you are trying to input data that you have stored using the Put command. It also may arise when you attempt to enter a program that you have saved to diskette.

Error Code 138: Device Timeout

Atari calls this the Device Timeout error. There are many factors that can cause it: The device did not respond within the specified time; You have specified the wrong device number or the wrong device; Or the device is not connected. If you are using the program recorder, you may have started the tape in the wrong place.

First, check to see that all your I/O cables are firmly seated, and all devices are turned on. Second, check your program for device errors.

Error Code 139: Device NAK

A peripheral device refuses to acknowledge a command (NAK - not acknowledge). The error is device-specific. Check to see that the offending peripheral device is configured correctly. For instance, in the case of the Atari 825 Printer, check that it is in the On Line position, rather than Local.

It is also possible that you have confused your computer and it is sending erroneous commands. Check your program.

Also check the manual that came with that device for hints.

Error Code 140: Serial Frame Error

A peripheral device is sending garbage to your computer. Atari says this is a fatal error, and if it happens more than once, have your computer or the peripheral device checked.

See the Atari Disk Operating System Reference Manual for more information.

Error Code 141: Cursor Out of Range

Aha, an error that is not generated by a peripheral device! This one means that your program has tried to place the cursor out of range of the particular graphics mode you are using. Recalculate the location or change your graphics mode. This, too, is covered in the Atari Basic Reference Manual.

Next month we'll discuss more I/O error codes, particularly some that are peculiar to the Atari 850 Interface Module.

Steve Harding is West Coast Editor of Hi-Res Magazine.