Sinclair Spectrums have error codes from 0 through to R with some extras if you have +3DOS (ie. you have a +3 or a +2A).
The following is a list of all errors, what they mean, and a short Sinclair BASIC program that will produce that error if you type it in and run on your spectrum.
- 0 OK
- The program or statement completed succesfully. Not really an error.
Example: PRINT
- 1 NEXT without FOR
- A NEXT statement was seen before its corresponding FOR.
Example: NEXT N
- 2 Variable not found
- A variable was referenced that has not yet been assigned a value.
Example: PRINT foo
- 3 Subscript wrong
- An attempt was made to access an element beyond the bounds of an array.
Example: DIM f(10) : PRINT f(11)
- 4 Out of Memory
- There is not enough free memory to perform the action.
Example: DIM d(1000,1000,1000,1000,1000,1000)
- 5 Out of Screen
- An INPUT statement has tried to generate more than 23 lines in the lower half of the screen. Also occurs with PRINT AT 22,xx
Example: PRINT AT 22,10;"cheese"
- 6 number too big
- A function has tried to calculate a number bigger that approx. 1038
Example: PRINT 10e30*10e30
- 7 RETURN without GOSUB
- The system has encountered a RETURN statement but has seen no GO SUB statement to RETURN to.
Example: RETURN
- 9 STOP statement
- Not really an error, a STOP statement has been encountered, causing the program to, ahem, stop.
Example: STOP
- A Invalid argument
- The argument to a function is invalid for some reason.
Example: PRINT USR "boing! boing!"
- B Integer out of range
- The number supplied as a parameter to a function which requires an integer was to big or small.
Example: GO TO 1e999
- C Nonsense in BASIC
-
- Means something silly has occurred, could be that the BASIC interperator has reached random data.
Example: PRINT VAL "Boing!!"
- D BREAK - CONT repeats
- The BREAK key has been pressed during some hardware action. After this error CONTINUE will start before the current statement and repeat it. Compare this with error L
Example: SAVE "ping"
Then press BREAK
- E Out of DATA
- A READ statement has run out of DATA elements. You've tried to READ past the end of the DATA (or there is no DATA).
Example: READ a
- F Invalid Filename
- You tried to SAVE with filename empty (or longer than 10 characters using tape)
Example: SAVE ""
- G No room for line
- There is not enough room in memory to enter the current line into the listing.
- H STOP in INPUT
- STOP has been entered as the response to an INPUT command.
Example: INPUT a
Then type STOP (as a token not as a word)
- I FOR without NEXT
- There was a FOR loop to be executed no times and the corresponding NEXT statement could not be found.
Example: FOR n=1 TO 0
- J Invalid I/O device
- You are attempting to input characters from (or output charaters to) a device that doesn't support it. For example, it is not possible to input characters from the screen stream.
Example: INPUT #2, a$
- K Invalid colour
- A colour has been referenced that doesn't exist.
Example: INK 69
- L BREAK into program
- The BREAK key has been pressed to gain access to a running program.
- M RAMTOP no good
- RAMTOP is the address of the high boundary of the BASIC program. This error means that the number specified for RAMTOP is either too big or too small.
Example: CLEAR 1089
- N statement lost
- If you're running a long string of commands from the command-line, but an error occurs you may want to CONTINUE. However, the speccy will only store the first few statements in memory, if the error was after that, you'll see this error.
- O Invalid stream
- Some sort of undocumented error has occured during communication with a Sinclair microdrive.
- P FN without DEF
- A user-defined function has been referenced without actually having been defined.
Example: PRINT FN a(2)
- Q Parameter error
- Wrong number of arguments, or one of them is the wrong type (string instead of number or vice versa).
- R Tape loading error
- Loading from tape failed. Have you been storing your tapes correctly? Does your head need cleaning or realligning?
Example: LOAD ""
Start loading something, then half way through, stop the tape :-)