ZX 81 - BASIC Programming

Sinclair ZX Spectrum
Appendix B - Report codes
This table gives each report code with a general description & a list of the situations where it can occur. In appendix C, a more detailed description of what error reports mean is given under each statement or function.

Code Meaning Situations
0 Successful completion, or jump to line number bigger than any existing. A report with code 0 does not change the line number used by CONT. Any
1 The control variable does not exist (has not been set up by a FOR statement) but there is an ordinary variable with the same name. NEXT
2 An undefined variable has been used.

For a simple variable this will happen if the variable is used before it has been assigned to in a LET statement.

For a subscripted variable it will happen if the variable is used before it has been dimensioned in a DIM statement.

For a control variable this will happen if the variable is used before it has been set up as a control variable in a FOR statement, when there is no ordinary simple variable with the same name.
Any
3 Subscript out of range.

If the subscript is hopelessly out of range (negative, or bigger than 65535) then error B will result.

Subscripted variables
4 Not enough room in memory. Note that the line number in the report (after the /) may be incomplete on the screen, because of the shortage of memory: for instance 4/20 may appear as 4/2. See chapter 23. For GOSUB see exercise 6 of chapter 14. LET, INPUT, DIM, PRINT, LIST, PLOT, UNPLOT, FOR, GOSUB.

Sometimes during function evaluation.
5 No more room on the screen. CONT will make room by clearing the screen. PRINT, LIST.
6 Arithmetic overflow: calculations have led to a number greater than about 1038. Any arithmetic
7 No corresponding GOSUB for a RETURN statement. RETURN
8 You have attempted INPUT as a command (not allowed). INPUT
9 STOP statement executed. CONT will not try to re-execute the STOP statement. STOP
A Invalid argument to certain functions. SQR, LN, ASN, ACS
B Integer out of range. When an integer is required, the floating point argument is rounded to the nearest integer. If this is outside a suitable range then error B results.

For array access, see also report 3.
RUN, RAND, POKE, DIM, GOTO, GOSUB, LIST, LLIST, PAUSE, PLOT, UNPLOT, CHR$, PEEK, USR

Array access
C The text of the (string) argument of VAL does not form a valid numerical expression. VAL
D (i) Program interrupted by BREAK.

(ii) The INPUT line starts with STOP.
At end of any statement, or in LOAD, SAVE, LPRINT, LLIST or COPY.

INPUT
E Not used  
F The program name provided is the empty string. SAVE

Sinclair ZX Spectrum

  Previous Page Back Next Page