27 Error Codes

The following list of errors includes BASIC errors, COS errors, and errors generated by the extension ROM. Note that it is possible to obtain errors not on this list by executing a BRK in a machine-code program.

2 Too many GOSUBs  

The largest permitted depth of subroutine nesting is 14. This error means that more than 14 GOSUB statements have been executed without matching RETURN statements. Example:

   10 GOSUB 10
   20 END
6 SUM Checksum error  

When loading a named file from tape, each block is followed by a checksum byte; if the checksum does not agree with this byte, this error is given. The cause of checksum errors is usually a damaged tape, or incorrect volume on playback. The remaining blocks of a damaged tape can be retrieved using FLOAD.

18 Too many DO statements  

The largest permitted number of nested DO...UNTIL loops is 11. This limit has been exceeded.

29 Unknown or missing function  

The statement contains a sequence of characters which are not the name of a function. Example:

   10 J=RAN+10    (where RND was intended).
   20 FPRINT $A    (string variables not permitted in FPRINT)
30 Array too large in DIM statement  

The DIM statement checks that there is valid merrory at the last element of each array in the DIM statement. This error implies that there is no RAM at the end of the array being dimensioned.

31 RETURN without GOSUB  

A RETURN was found in the main program. RETURN is only meaningful in a subroutine.

39 Attempt to use variable in LIST  

The LIST command may only be used with constants as its arguments.
Example:

       LIST A,B
48 COM? Command error  

The command following the '*' was not a legal COS command. Example:

       *MEM    (command does not exist)
69 Illegal FDIM statement  

Only the floating-point array variables %AA to %ZZ may be dimensioned in an FDIM statement. Example:

   10 FDIM %A(2)

Attempt to use FDIM in direct mode.

76 Assembler label error  

The characters following the ':' character are not a legal label. Legal labels are two letters followed by a number optionally in brackets. Example:

   10:LOOP JMP LOOP
91 No hexadecimal number after  

The characters immediately following the '#' symbol must be legal hexadecimal characters 0-9 or A-F. Spaces are not permitted. Example:

   10 PRINT #J
94 Unknown command, invalid statement terminator; missing END  

The statement has not been recognised as a legal BASIC statement. The error may also be caused by an illegal character after a valid statement, or by an attempt to execute past the end of the program.
Example:

   10 LIST    (LIST is not allowed in a program)
   20 s A=B    (no space permitted between label and line number)

An array appears in an INPUT statement; only simple variables are permitted. Example:

   25 INPUT AA(2)
95 Floating-point item missing or malformed  

An unexpected character was encountered during the interpretation of a floating-point statement. Example:

   10 FUNTIL O    (argument must be a relational expression)
   20 FIF A PRINT "OK"    (logical variables not allowed)
109 Number too large  

Attempt to enter a number which is too large to be represented in BASIC. Example:

   20 J=9999999999

Error also occurs if the largest negative number is entered:

   30 J=-2147483648

even though this number can be represented internally. To input this number, use the hexadecimal form #80000000.

111 Missing variable in FOR; too many FOR statements  

The control variable in a FOR...NEXT loop must be one of the simple variables A to Z. Example:

  35 FOR CC(1)=1 TO 10

The maximum permitted number of nested FOR...NEXT loops is 11; this number has been exceeded.

118 NAME Name error  

The filename specified in a LOAD, SAVE, *LOAD, *SAVE, or *FLOAD command was not a legal COS filename. Example:

      SAVE "THIS FILENAME IS TOO LONG"
123 Illegal argument to floating-point function  

Examples:

   12 A=SQR(-1)   (square root of a negative number)
   24 B=ASN(2)    (arcsine of number outside range -1 to 1)
127 Line number not found in GOTO or GOSUB  

The line number specified in a GOTO or GOSUB was not found. Example:

   10 GOTO 6
   15 N=6; GOTO N    (where there is no line 6)
128 Argument to SIN, COS or TAN too large  

The largest angle that may be specified in the SIN, COS or TAN functions is about 8.3E6.

129 Division by zero, protected RAM in graphics mode  

A number was divided by zero. Example:

   10 J=J/(A-B)    (where A and B were equal)

A CLEAR command specified a graphics mode that would have destroyed BASIC's text space. Example:

   10 ?18=t90 ;REM Move text space
   20 CLEAR 4
134 Array subscript out of range  

An array element was specified with a negative subscript, or has not been dimensioned before use. Example:

  10 DIM AA(4)
  20 AA(-2)=7
135 SYN? Syntax error  

A COS command was recognised, but was followed by illegal parameters.
Example:

     *SAVE "FRED"    (start and end addresses omitted)
149 Floating-point array subscript out of range  

A floating-point array element was specified with a negative subscript. Example:

  10 %AA(-2)=0
152 GOSUB without RETURN; FOR without NEXT  

The GOSUB statement, when used in direct mode, must be followed by a semicolon. Example:

      GOSUB 10

The FOR statement was used in direct mode without a NEXT statement.

156 Assembler error: illegal type  

The argument specified for the operation is illegal. Example:

   30 LDA 0300   (constant greater than 8 bits)
   50 STA (J,Y)  (not a legal addressing mode)
   70 BIT 023    (immediate addressing not available with BIT)

This error is also generated if a JMP or JSR is assembled with a zero-page address. This may occur, by chance, on the first pass of a forward-reference JMP or JSR; in this case the value of the label should be initialised to P before assembling. Example:

   40 JMP #34    (jumps into page zero are not permitted)
157 Label not found  

A label, a-z, was specified in a GOTO or GOSUB, but no statement
starting with that label was found. Example:

   40 GOTO s
159 Unmatched quotes in PRINT or INPUT  

Strings in PRlNT statements, or entered in INPUT statements, should have an even number of '"' quotation marks. Example:

      PRINT "THIS IS A QUOTE:""
165 Loading interrupted  

The CTRL key will escape from a load-from-tape operation, with this error message being produced.

169 Floating-point result too large  

The result of a floating-point calculation was larger than about 1.7E38. Example:

   20 FPRINT TAN(PI/2)
174 Significant item missing or malformed  

An unexpected character was encountered during the interpretation of a statement. Example:

   10 G0TO 20                (O mistyped as zero; should be GOTO)
   20 FOR J TO 4             (expected '=' after J)
   30 FOR J=l STEP 1 TO 4    (order should be TO ... STEP)
   40 LET AA(1)=2            (LET is illegal with arrays)
191 LOG or power of zero or a negative number  

The argument to the floating-point function LOG, or the operator must be greater than zero. Examples:

   10 %A=-1"2
   30 %B=LOG(0)
198 UNTIL with no DO  

An UNTIL statement was encountered without a DO being active. Example:

   20 IF A=l DO A=A+1
   30 UNTIL A=3    (if A<>1 the DO is not executed)
200 Unmatched quotes in string  

Strings appearing in a program should have an even number of quotation marks.

 

208 Unrecognised mnemonic in assembler  

The mnemonic is not a legal 6502 assembler operation. Example:

   20 ADD 020    (only ADC instruction available)
   30 .BYTE    (assembler directives are not available)
216 Illegal DIM statement  

The list of variables in the DIM statement contained an illegal entry.
Example:

   20 DIM A(2,3)    (only one-dimensional arrays allowed)
   30 DIM AA(-2)    (negative array size)

Attempt to use DIM in direct mode.

230 NEXT without matching FOR  

If a control variable is specified in a NEXT statement then the variable must match the control variable in the corresponding FOR statement. Example:

   50 FOR N=1 TO 10
   20 FOR J=1 TO 10
   30 PRINT "*"
   40 NEXT N
   50 NEXT J

A NEXT statement was encountered without any FOR statement being active.

238 Argument to EXP too large  

The calculation of the EXP function gave a result that was too large.
Example:

   10 FPRINT EXP(100)
248 Not enough room to insert line  

The line just entered has used up all the available memory. More memory can be released by shortening all the command names if this has not already been done.