Contents / Reference section / Previous chapter / Next chapter / Index
If the computer is unable to proceed for some reason then it will report that fact to you by printing an error message on the screen. The printing of the message can be supressed by the statement, for example
ON ERROR GOTO 9000
provided that some special routines had been written in line 9000. As well as the error message the computer sets two variables each time an error occurs.
ERR gives the "Error number"
ERL gives the number of the line in the program where the error occurred.
The error messages are listed below in alphabetical order together with their error numbers
If you try to calculate trigonometric functions with very large angles you are liable to lose a great deal of accuracy in reducing the angle to the range of plus or minus PI radians. In this case the computer will report Accuracy lost.e.g.
PRINT SIN(10000000)
This error indicates that there are too many or too few arguments for a given function or procedure.
This indicates that the computer thinks that an array is to be accessed but does not know the array in question.
This indicates that the use of PROC or FN to call a defined procedure or function is incorrect.
Arrays must be dimensioned with a positive number of elements. An error will be produced for example by
DIM A(-3)
Hex numbers can only include 0 to 9 and A to F. An attempt to form a hex number with other letters will result in this error e.g.
PRINT &y
This indicates an attempt to change MODE inside a procedure or function, or to select a mode for which there is insufficient
memory.
There are a number of occasions on which the computer checks to see where the program that it contains starts and ends in memory. The untrapable error BAD program indicates that the computer could not follow a program through successfully to an end mark in memory. This is caused by a read error or by only loading part of a program or by overwriting part of the program in some way. Unless you are prepared to check the contents of memory a byte at a time there is little that can be done to recover a bad program.
This is an error generated by the cassette filing system. It indicates that an unexpected block number was encountered. Rewind the tape a short way and play it again.
An attempt was made, during an assembly language section, to load a register with a number requiring more than one byte e.g.
LDA #345
There is no FOR statement corresponding to the NEXT statement.
This error is generated by the cassette filing system if an attempt is made to use a channel that was not opened.
This is an error generated by the cassette filing system and it means that the computer has found a Cyclic Redundancy Check (CRC) error. The CRC is stored on the tape along with other internal information - see page 399 for more information. Rewind the tape a short way and play it again.
An attempt was made to dimension an array for which there was insufficient room.
Division by zero cannot be done! e.g.
PRINT 34/0
This error can also be caused by a division within a procedure or function using a LOCAL variable which has not been set to a new value. When a variable is declared as LOCAL it is set to zero.
The user may put strings into any place in memory except zero page, that is locations less than 100 hex. Thus this is illegal:
$40="hello"
This error is generated by the cassette filing system if the end of the file is reached.
The ESCAPE key has been pressed.
The function EXP cannot deal with powers greater than 88. Thus the following is illegal.
X=EXP (90)
When renumbering a program the computer attempts to look after all references made by GOTO and GOSUB statements. Thus the program
133 GOTO 170
170 END
would become
10 GOTO 20
20 END
when renumbered. However, the computer would not be able to deal with
133 GOTO 140
200 END
If the user attempts to renumber this program he will get the error message
Failed at 10
and the renumbered program will be
10 GOTO 140
20 END
This error generated by the cassette filing system indicates that an unexpected file name was encountered by the computer.
The variable in a FOR...NEXT loop must be a numeric variable. Thus the following is illegal
FOR 5=3 TO 10
This is an error generated by the cassette filing system and it indicates that a header Cyclic Redundancy Check error has occurred - see page 399 for further information. Rewind the tape a short way and play it again.
This indicates an error in specifying an index mode when using the assembler e.g. LDA Z,Z.
The computer has no room left to insert the line in the program.
An attempt was made to calculate the LOG of a negative number or of zero. e.g. PRINT LOG(-10)
This error indicates that the computer expected to find a comma in the line, and didn't do so, e.g.
D$=MID$(A$)
The computer expected to find a double quote. e.g.
LOAD "FRED
The computer expected a closing bracket. e.g.
PRINT TAB(10,10
This indicates that the computer could not make any sense of the input line.
An attempt was made to calculate the square root of a negative number. e.g.
PRINT SQR(-10)
This may also occur with ASN and ACS.
A RETURN statement was found when no GOSUB statement had been encountered.
This indicates that the computer detected the end of a function but had not called a function definition. e.g.
=FNsue
A NEXT statement was found when no FOR statement had been encountered.
This indicates that the word ENDPROC was found without there being a corresponding DEF PROC statement.
The interpreter found an UNTIL statement when no REPEAT statement had been encountered.
This untrapable error indicates that while the computer was running a program it used up all available memory.
If the interpreter meets a name beginning with FN (e.g. FNfred) or PROC (e.g. PROCsteve) it expects to be able to find a corresponding function or procedure definition somewhere. This error indicates that no matching definition was found.
The computer was told to GOTO or GOSUB a line number which does not exist.
All variables must be assigned to, or made LOCAL, before they can be accessed in PRINT statments or before their values can be assigned to other variables. The initial assignment can simply be for example, X=0.
A FOR...NEXT loop has been set up with the TO part missing. A correctly formed line is shown below
FOR X=10 TO 55
This indicates the appearance of LOCAL outside a procedure or function.
The control variable was either less than 1 or greater than the number of entries in the ON list. For example if X=3 then this will fail.
ON X GOTO 100,200
since there are only two destinations.
The ON...GOTO statement was misformed, for example this is illegal
ON X PRINT
The word ON must be followed by a numeric variable which must in turn be followed by the word GOTO or GOSUB.
An attempt was made to read more items of DATA than there were in the DATA list. The word RESTORE can be used to reset the data pointer to the start of the DATA if required.
An attempt was made to branch out of range of the branch instruction in the assembler.
This message will be issued if you attempt to renumber a program or enter AUTO mode with a step size of 0 or more than 255. e.g.
AUTO 100,0
This error is generated by the cassette filing system. It indicates that a syntax error, such as an illegal *OPT statement has occurred.
The maximum length of a string is 255 characters.
This implies that an attempt was made to access an element of an array less than zero or greater than the size of the array. For example these two lines together will produce this error.
100 DIM A(10)
120 A(15)=3
A command was terminated wrongly for example
LIST PRINT
A number was entered or calculated which was too large for the computer to handle.
An attempt was made to "nest" too many FOR...NEXT loops. The maximum nesting allowed is 10. This can sometimes be caused by returning to a FOR statement without executing a NEXT statement. e.g.
10 FOR X=1 TO 6
20 GOTO 10
An attempt was made to "nest" too many
GOSUB...RETURN loops. The maximum nesting allowed is
26. This can sometimes be caused by returning to a GOSUB
statement without executing a RETURN statement. e.g.
10 PRINT "WRONG"
20 GOSUB 10
An attempt was made to "nest" too many REPEAT...UNTIL loops. The maximum nesting allowed is 20. This can sometimes be caused by returning to a REPEAT statement without executing an UNTIL statement. e.g.
10 REPEAT
20 GOTO 10
This error indicates that a number was expected and a string was offered or vice-versa. e.g.
10 A$=X
Error number | Error message | Error number | Error message |
1 | Out of range | 28 | Bad Hex |
2 | Byte | 29 | No such FN/PROC |
3 | Index | 30 | Bad call |
4 | Mistake | 31 | Arguments |
5 | Missing , | 32 | No FOR |
6 | Type mismatch | 33 | Can't match FOR |
7 | No FN | ||
8 | $ range | 34 | FOR variable |
9 | Missing " | 35 | Too many FORs |
10 | Bad DIM | 36 | No TO |
11 | DIM space | 37 | Too many GOSUBs |
12 | Not LOCAL | ||
13 | No PROC | 38 | No GOSUB |
14 | Array | 39 | ON syntax |
15 | Subscript | 40 | ON range |
16 | Syntax error | 41 | No such line |
17 | Escape | 42 | Out of DATA |
18 | Division by zero | 43 | No REPEAT |
19 | String too long | 44 | Too many REPEATs |
20 | Too big | ||
21 | -ve root | 216 | Data? |
22 | Log range | 217 | Header? |
23 | Accuracy lost | 218 | Block? |
24 | Exp range | 219 | File? |
25 | Bad MODE | 220 | Syntax |
26 | No such variable | 222 | Channel |
27 | Missing ) | 223 | Eof |
The BBC Microcomputer User Guide was written by John Coll and edited by David Allen for the British Broadcasting Corporation.
Optical character recognition and original formatting effort by Mark Usher.
HTML version maintained by: Kade "Archer" Hansson; e-mail: archer@dialix.com.au
Last updated: Monday 12th February 2001