RTR logo

R. T. RUSSELL

BBC BASIC (86) Manual



Error Messages and Codes

Annex C to
BBCBASIC(86)

Summary

Trappable - Program

NoError NoError
1Out of range 2Size needed
3Multiple label 4Mistake
5Missing , 6Type mismatch
7No FN 8*
9Missing " 10Bad DIM
11DIM space 12Not LOCAL
13No PROC 14Array
15Subscript 16Syntax error
17Escape 18Division by zero
19String too long 20Too big
21-ve root 22Log range
23Accuracy lost 24Exp range
25Bad MODE 26No such variable
27Missing ) 28Bad HEX
29No such FN/PROC    30Bad call
31Arguments 32No FOR
33Can't match FOR 34FOR variable
35* 36No TO
37* 38No GOSUB
39ON syntax 40ON range
41No such line 42Out of DATA
43No REPEAT 44  *
45  Missing #   
   98Wrap
* Not applicable to BBCBASIC(86)

Trappable - Operating System

NoError NoError
189Access denied        192Too many open files
196File exists 198Disk full
199Disk fault 201Disk read only
202Device fault 204Bad name
205Bad drive 206Bad directory
214File not found 222Channel
251Bad key 253 Bad string
254 Bad command   

Untrappable - Error Code 0

No room RENUMBER space
Silly LINE space
Sorry Bad program
Failed at nnn  
Strictly speaking 'Bad program' does not have an error code. It leaves ERR and ERL unchanged.


Details

BBCBASIC(86)'s error messages and codes are briefly explained below in alphabetical order.

Access denied

189

This is something of a 'catch all' error message. It originates from MS-DOS (PC DOS) and occurs whenever the operating system thinks you are trying to illegally write to or delete a file or directory.

The most common case of this error is trying to write to a file that was opened for input with OPENIN. If you wish to write to an existing file, you should open it for read/write with OPENUP.

On a network system, this error may indicate that you are trying to access a file that has been locked by another user. For example, two users trying to open the same file with OPENUP will give rise to this error.

You will also get this error if you try to remove a directory which has files in it. If you wish to remove (delete) a directory you must first delete all the files in it.

Accuracy lost

23

Before BBCBASIC(86) calculates trigonometric functions (sin, cos, etc) of very large angles the angles are reduced to +/- PI radians. The larger the angle, the greater the inaccuracy of the reduction, and hence the result. When this inaccuracy becomes unacceptable, BBCBASIC(86) will issue an 'Accuracy lost' error message.

Arguments

31

This error indicates that too many or too few arguments have been passed to a procedure or function or an invalid formal parameter has been used. See the sub-section on Procedures and Functions.

Array

14

This error occurs when BBCBASIC(86) thinks it should be accessing an array, but does not know which one.

Bad call

30

This error indicates that a procedure or function has been incorrectly called.

Bad command

254

This error occurs when a command name is not recognized as a valid BBCBASIC(86) command. Star commands which are unknown to BBCBASIC(86) are passed to MS-DOS. If the command is unrecognised by MS-DOS, an untrappable 'Bad command or file name' error occurs.

Bad DIM

10

Arrays must be positively dimensioned. In other words, the numbers within the brackets must not be negative. This error would be produced by the following example.

DIM table(20,-10)

Bad directory

206

If an attempt is made to access a directory which does not exist or if there are illegal characters in a file name, a 'Bad directory' error will be reported. For example, the command
*REN WOMBAT? TEST?
would give rise to the 'Bad directory' error.

Bad drive

205

If the MS-DOS (PC DOS) operating system complains about an incorrectly specified drive, this error will be reported.

Bad HEX

28

Hexadecimal numbers can only include the numbers 0 to 9 and A to F. If you try to form a hex number with other characters this error will occur. For example:

&OF instead of &0F

Bad key

253

This error is generated if the key number in a *KEY command is greater than 23.

Bad MODE

25

This error will be generated if an attempt is made to set an inappropriate screen mode for the hardware available. For example, trying to set MODE 8 on a computer which does not have an EGA or VGA would cause this error.

Bad name

204

This error is generated if a path name exceeds 64 characters in length.

Bad program

From time to time BBCBASIC(86) checks to see that the program in memory is of the correct format (See Annex E). If it is unable to follow the program from the start to the 'program end marker' it will report this untrappable error. The error can be caused by a read error, by only loading part of the program or by overwriting part of the program in some way. (Machine code programmers beware.) Without a full understanding of how a program is stored in memory, there is little you can do to recover a bad program.

Bad string

253

File names in 'star' commands may optionally be enclosed in quotes. This error will occur if the quotes are unmatched. The following example would give rise to this error.

*SAVE "GRAPHS

Can't match FOR

33

BBCBASIC(86) has been unable to find a FOR statement corresponding to the NEXT statement.

Channel

222

This error is generated by the disk filing system. It occurs if you try to use a channel which has not been opened, possibly because you are using the wrong channel number.

Device fault

202

If the MS-DOS (PC DOS) operating system discovers a device fault whilst BBCBASIC(86) is trying to use that device, this error will be reported.

DIM space

11

This error will be generated if:

Disk fault

199

This error will occur if an attempt to access a disk has failed. It will occur, for example, if you try to save a program to a drive which does not have a (formatted) disk in it. If you manage to place the disk in the drive before the error timeout expires, the access will be successful.

Disk full

198

This error will occur if there is insufficient room on the disk for the data/program being written to it.

Disk read only

201

This error will be reported if an attempt is made to write to a disk which is write protected.

Division by zero

18

Mathematically, dividing by zero gives an infinitely large answer. The computer is unable to understand the concept of infinity (it's not alone) and this error is generated. If there is any possibility that the divisor might be zero, you should test for this condition before carrying out the division. For example:

200 IF divisor=0 THEN PROC_error ELSE...

Escape

17

This error is generated by pressing the <Esc> key. You can trap this, and other errors, by using the ON ERROR GOTO statement. You can inhibit the generation of the 'Escape' error by using *ESC OFF. The <Esc> key then returns the ASCII value of escape (&1B). *ESC ON restores the default action of the <Esc> key.

Exp range

24

The EXP function is unable to cope with powers greater than 88. If you try to use a larger power, this error will be generated.

Failed at nnn

During renumbering, BBCBASIC(86) tries to resolve all line numbers referred to by GOTO and GOSUB statements. Should it fail, it will generate a 'Failed at nnn' error, where nnn is the RENUMBERED line which contains the unresolved reference.

The following example:

100 REM Demonstration renumber fail program
110 GOTO 250
120 END
would renumber as:
10 REM Demonstration renumber fail program
20 GOTO 250
30 END
and generate the error message 'Failed at 20'.

File exists

196

This error will be generated if you try to rename a file and a file with the new name already exists.

File not found

214

This error will occur if you try to LOAD, *LOAD or CHAIN a file which does not exist.

FOR variable

34

The variable in a FOR...NEXT loop must be a numeric variable. If you use a constant or a string variable this error message will be generated. For example, the following statements are not legal.

20 FOR name$=1 TO 20

20 FOR 10=1 TO 20

LINE space

A program line is too long to be represented in BBCBASIC(86)'s internal format.

Log range

22

Logarithms for zero and negative numbers do not exist. This error message will be generated if you try to calculate the log of zero or a negative number or raise a negative number to a non-integer power.

Missing ,

5

This error message is generated if BBCBASIC(86) was unable to find a comma where one was expected. The following example would give rise to this error.

20 PRINT TAB(10 5)

Missing "

9

This error message is generated if BBCBASIC(86) was unable to find a double-quote where one was expected. The following example would give rise to this error.
10 name$="Douglas

Missing )

27

This error message is generated if BBCBASIC(86) was unable to find a closing bracket where one was expected. The following example would give rise to this error.
10 PRINT SQR(num

Missing #

45

This error will occur if BBCBASIC(86) is unable to find a hash symbol (a pound symbol on some computers) where one was expected. The following example would cause this error.
CLOSE 7

Mistake

4

This error will be generated if BBCBASIC(86) is unable to make any sense at all of the input line.

Multiple label

3

If, during the first pass of an assembly (OPT 0 or 1), a label is found to have an existing non-zero value, a 'Multiple label' error will be reported.

-ve root

21

This error message will occur if BBCBASIC(86) attempted to calculate the square root of a negative number. It is possible for this error to occur with ASN and ACS as well as SQR.

 90 num=-20
100 root=SQR(num)

No GOSUB

38

This error message will be generated if BBCBASIC(86) finds a RETURN statement without first encountering a GOSUB statement. (See the sub-section on Program Flow Control.)

No FN

7

If BBCBASIC(86) encounters an end of function without calling a function definition, this error message will be issued. If you forget to put multi-line function definitions out of harm's way at the end of the program you are very likely to get this error message. (See the sub-section on Procedures and Functions.)

No FOR

32

This error message indicates that BBCBASIC(86) has found a NEXT statement without first encountering a FOR statement.

No PROC

13

If BBCBASIC(86) encounters an ENDPROC without performing (calling) a procedure definition, this error message will be issued. If you forget to put multi-line procedure definitions out of harm's way at the end of the program you are very likely to get this error message. (See the sub-section on Procedures and Functions.)

No REPEAT

43

This error message indicates that BBCBASIC(86) has found an UNTIL statement without first encountering a REPEAT statement.

No room

This untrappable error indicates that all the computer's available memory was used up whilst a program was running. This error may occur as a result of numerous assignments to string variables, as in a string sort. See the explanation of String Variables and Garbage in the Variables sub-section for details.

No such FN/PROC

29

When BBCBASIC(86) encounters a name beginning with FN or PROC it expects to be able to find a corresponding function or procedure definition. This error will occur if such a definition does not exist.

No such line

41

This error will occur if BBCBASIC(86) tries to GOTO, GOSUB, TRACE or RESTORE to a non-existent line number.

No such variable

26

Variables are brought into existence by assigning a value to them or making them LOCAL in a function or procedure definition. This error message will be generated if you try to use a variable on the right-hand side of an assignment or access it in a PRINT statement before it has been created. As shown below, you can create variables very simply.

10 count=0
20 name$=""

No TO

36

This error message will be generated if BBCBASIC(86) encounters a FOR...NEXT loop with the TO part missing.

Not LOCAL

12

If you try to define a variable as LOCAL outside a procedure or function, this error message will be generated. If you forget to put multi-line function definitions out of harm's way at the end of the program you are very likely to get this error message. (See the sub-section on Procedures and Functions.)

ON range

40

This error will be generated if, in a simple ON GOTO/GOSUB/PROC statement, the control variable was less than 1 or greater than the number of entries in the ON list. These exceptions can be trapped in ON GOTO/GOSUB/PROC statements by using the ELSE option. The first example below will generate an 'ON range' error, whilst the second is correct.

10 num=4
20 ON num GOTO 100,200,300

10 num=4
20 ON num GOTO 100,200,300 ELSE 1000

ON syntax

39

This error will be reported if the ON...GOTO statement was misformed. For example, the following statement is not legal. (Refer to the keyword ON for details of legal statements.)

20 ON x TIME=0

Out of DATA

42

If your program tried to read more items of data than there were in the data list, this error will be generated. You can use RESTORE to return the data pointer to the first data statement (or to a particular line with a data statement) if you wish.

Out of range

1

This assembly language error will be reported if you tried to perform a relative jump of more than +127 or -128 bytes or you used a 16 bit port address when only an 8 bit address is allowed.

RENUMBER space

When BBC BASIC RENUMBERs a program it has to build a cross-reference table of line numbers. If there is insufficient memory to hold this table, the 'RENUMBER space' error results. In this case you can still renumber the program using the RENUMBER.COM utility program supplied.

Silly

This error message will be issued if you try to renumber a program or enter AUTO with a step size of 0. AUTO with a step size of more than 255 will work, but it will be evaluated MOD 256.

Size needed

2

Certain assembly language instructions need specifically to specify whether a byte or a word is to be acted upon. (INC byte ptr [bx] and MOV word ptr [count],0 for example.) If this is not done, a 'Size needed' error will be reported.

String too long

19

You will get this error message if your program tries to generate a string which is longer than 255 characters.

Subscript

15

If you try to access an element of an array less than zero or greater than the size of the array you will generate this error. Both lines 20 and 30 of the following example would give rise to this error message.

10 DIM test(10)
20 test(-4)=20
30 test(30)=10

Syntax error

16

A command was terminated incorrectly. In other words, the first part of the command was recognized, but the rest of it was meaningless or incomplete. Unlike Mistake, BBCBASIC(86) was able to recognise the start of the command.

Too big

20

This error will occur if a number is entered or calculated which is too big for BBCBASIC(86) to cope with.

Too many open files

192

This error will occur if you try to open more files at any one time than allowed by MS-DOS (PC DOS).

MS-DOS (PC-DOS) will usually allow three open files at any one time in addition the the 5 files it uses for input and output. This may be altered by including a 'FILES=nnn' command in your CONFIG.SYS file. See Opening Files in the BBCBASIC(86) Disk Files section, *OPT in the Operating System Interface section and your MS-DOS Users Guide for more details.

Type mismatch

6

This error indicates that a number was encountered when a string was expected and vice-versa. Don't forget that this can occur if the actual parameters and the formal parameters for a function or procedure do not correspond. (See sub-section on Procedures and Functions for details of parameter passing to functions and procedures.)

Wrap

98

If, during assembly, the least significant word (16-bits) of the program counter, P%, increments from &FFFF to &0000, a 'Wrap' error will occur.

Left CONTENTS

CONTINUE Right


Best viewed with Any Browser Valid HTML 3.2!
© Doug Mounter and Richard Russell 1999