Commodore 64 BASIC V2 Error Messages

I’ve launched a new Youtube channel called “8-Bit Show and Tell”. The first video is about the various errors that C-64 BASIC will display, and can be watched here:
https://youtu.be/9V1wFXKHTgw

It was suggested that this information would be useful in text form, so I’m presenting it here in my blog. Most of this information can be found in the C64 User’s Guide and Programmer’s Reference Guide (Appendix L and K respectively), but there’s a handful of omissions and errors in those lists that I’ve corrected here.

The descriptions are lifted from the PRG when appropriate, and I’ve written my own for the missing error messages. I’ve included a short example of my own making to produce each error. I hope this is useful. If I’ve made any errors or omissions myself, please let me know in the comments.

Commodore 64 BASIC V2 Error Messages

  • BAD SUBSCRIPT ERROR

    Description: The program was trying to reference an element of an array whose number is outside of the range specified in the DIM statement.

    Example:
    A(11) = 0

    DIM B(2)
    B(3) = 5

  • BREAK ERROR

    Description: Disk or cassette access was stopped because you hit the STOP key.

    Notes:

    1. This error was left out of Appendix L in the C64 User’s Guide completely
    2. It was included in Appendix K of the C64 Programmer’s Reference Guide as “Program execution was stopped because you hit the STOP key” but this is not the BREAK *ERROR* but merely how to create the BREAK message.
    3. This error message has 3 spaces between BREAK and ERROR, compared to the usual 2 spaces of the other error messages.

  • CAN’T CONTINUE ERROR
    Description: The CONT command will not work, either because the program was never RUN, there has been an error, or a line has been edited.

    Example:
    10 PRINT "HI"
    CONT

  • DEVICE NOT PRESENT ERROR
    Description: The required I/O device was not available for an OPEN, CLOSE, CMD, PRINT#, INPUT#, or GET#.

    Example: Without device 9 (such as a 2nd disk drive) attached:
    LOAD”$”,9

  • DIVISION BY ZERO ERROR
    Description: Division by zero is a mathematical oddity and not allowed.

    Example:
    ?0/0

  • EXTRA IGNORED
    Description: Too many items of data were typed in response to an INPUT statement. Only the first few items were accepted.

    Example:
    10 INPUT A,B,C
    RUN
    1,2,3
    RUN
    1,2,3,4

    Notes: Like REDO FROM START, this error doesn’t actually print the word “ERROR”, and doesn’t stop program execution. It’s an error (or warning) directed at the user to correct their input.

  • FILE DATA ERROR
    Description: String data was received from an open file, but the program was expecting numeric data.

    Example:
    10 OPEN 1,0
    20 INPUT#1,A
    RUN
    Y

  • Notes: This is referred to as the BAD DATA ERROR in the C64 User’s Guide and PRG. This was the original error name in the very early Commodore PET ROMs, but had been renamed in later PET revisions, as well as the VIC-20, so it’s strange that the C64 documentation still had the old naming.

  • FILE NOT FOUND ERROR
    Description: If you were looking for a file on tape, and END-OF-TAPE marker was found. If you were looking on disk, no file with that name exists.

    Example: On a disk that doesn’t contain the file “WHATEVER”:
    LOAD”WHATEVER”,8

  • FILE NOT OPEN ERROR
    Description: The file specified in a CLOSE, CMD, PRINT#, INPUT#, or GET#, must first be OPENed.

    Example:
    PRINT#0

  • FILE OPEN ERROR
    Description: An attempt was made to open a file using the number of an already open file.

    Example:
    OPEN 1
    OPEN 1

  • FORMULA TOO COMPLEX ERROR
    Description: The string expression being evaluated should be split into at least two parts for the system to work with, or a formula has too many parentheses.

    Example:
    ?(“”+(“”+(“”+(“”))))

    or
    ?POS(“”)POS(“”)POS(“”)

  • ILLEGAL DEVICE NUMBER ERROR
    Description: Attempting to LOAD from a device between 0 and 255 that doesn’t support LOADing, such as devices: 0, 2, and 3. Attempted LOADing from a device outside of the range will trigger an ILLEGAL QUANTITY range.

    Example:
    LOAD”FILE”,0

    Notes: Not included in the C64 User’s Guide or PRG.

  • ILLEGAL DIRECT ERROR
    Description: The INPUT statement can only be used within a program, and not in direct mode.

    Example:
    INPUT A$

  • ILLEGAL QUANTITY ERROR
    Description: A number used as the argument of a function or statement is out of the allowable range.

    Example:
    POKE -1,0
    or
    POKE 0,256

  • LOAD ERROR
    Description: There is a problem with the program on tape.

    Example of generating a LOAD ERROR:
    10 ?CHR$(205.5+RND(1));:GOTO10
    SAVE”10 PRINT”
    rewind the tape
    LOAD
    When the file is found, hit run/stop
    SAVE”BREAK IT”
    rewind the tape
    LOAD

  • MISSING FILE NAME ERROR
    Description: A non-null filename string must be included in disk operations.

    Example:
    LOAD””,8

    Notes: Missing from both the C64 User’s Guide and PRG.

  • NEXT WITHOUT FOR ERROR
    Description: This is caused by either incorrectly nesting loops or having a variable name in a NEXT statement that doesn’t correspond with one in a FOR statement.

    Example:
    NEXT
    Or in a program:
    10 FOR X = 1 TO 10:NEXT
    20 NEXT
    RUN

  • NOT INPUT FILE ERROR
    Description: An attempt was made to INPUT or GET data from a file which was specified to be for output only.

    Example:
    OPEN 0

  • NOT OUTPUT FILE ERROR
    Description: An attempt was mode to PRINT data to a file which was specified as input only.

    Example:
    OPEN 1,1,0
    PRINT#1

  • OUT OF DATA ERROR
    Description: A READ statement was executed but there is no data left unREAD in a DATA statement.

    Example:
    Hit return on READY.
    Or
    10 READ A : READ B
    20 DATA 1
    RUN

  • OUT OF MEMORY ERROR
    Description: There is no more RAM available for program or variables. This may also occur when too many FOR loops have been nested, or when there are too many GOSUBs in effect.

    Example:
    0 GOSUB 0
    RUN

  • OVERFLOW ERROR
    Description: The result of a computation is larger than the largest number allowed, which is 1.70141884E+38.

    Example:
    PRINT 2^127

  • REDIM’D ARRAY ERROR
    Description: An array may only be DIMensioned once. If an array variable is used before that array is DIM’D, an automatic DIM operation is performed on that array setting the number of elements to ten, and any subsequent DIMs will cause this error.

    Example:
    DIM A(5):DIM A(6)

  • REDO FROM START
    Description: Character data was typed in during an INPUT statement when numeric data was expected. Just re-type the entry so that it is correct, and the program will continue by itself.

    Example:
    10 INPUT A
    RUN
    HI

  • Notes: Like EXTRA IGNORED, this error doesn’t actually print the word “ERROR”, and doesn’t stop program execution. It’s an error (or warning) directed at the user to correct their input.

  • RETURN WITHOUT GOSUB ERROR
    Description: A RETURN statement was encountered, and no GOSUB command has been issued.

    Example:
    10 RETURN

  • STRING TOO LONG ERROR
    Description: A string can contain up to 255 characters.

    Example:
    10 A$=A$+”X”:GOTO 10

  • SYNTAX ERROR
    Description: A statement is unrecognizable by the Commodore 64. A missing or extra parenthesis, misspelled keywords, etc.
    in the manual it specifies ?SYNTAX ERROR with the question mark and error (but not the double space in front of error) but it doesn’t include those for the other errors

    Example:
    FOUR OVER TWICE

  • TOO MANY FILES ERROR
    Description: Attempting to open more than 10 files at once.

    Example:
    10 FOR X=1 TO 11
    20 OPEN X,8
    30 ?”OPENED FILE:”;X
    40 NEXT
    RUN

    Notes: Missing from C64 User’s Guide and PRG.

  • TYPE MISMATCH ERROR
    Description: This error occurs when a number is used in place of a string, or vice-versa.

    Example:
    A$=-1
    Or
    A=”HI”

  • UNDEF’D FUNCTION ERROR
    Description: A user defined function was referenced, but it has never been defined using the DEF FN statement.

    Example:
    ?FN X(0)

  • UNDEF’D STATEMENT ERROR
    Description: An attempt was made to GOTO or GOSUB or RUN a line number that doesn’t exist.

    Example:
    RUN 10
    or
    GOTO 0

  • VERIFY ERROR
    Description: The program on tape or disk does not match the program currently in memory.

    Example:
    10 PRINT ”C64 RULES”
    RUN
    SAVE”TEST1”,8
    VERIFY”TEST1”,8

    Modify program to:
    10 PRINT ”C64 RULEZ”
    VERIFY”TEST1”,8

2 Responses to “Commodore 64 BASIC V2 Error Messages”

  1. Luca Says:

    Hi Robin
    i have a question about a commodore 64 error, how can i send you a screenshot?
    Thanks!

  2. stan baker Says:

    Hi! Love your youtube videos! Are you aware of whether there is a bug or not in the VICE x128 emulator? Something as ridiculously simple as the following works fine in the x64sc.exe but results in the following when attempting to execute it via BASIC via the x128.exe emulator.

    load”printit.o”,9,1

    searching for printit.o
    loading
    ready.
    sys 32768

    ?illegal quantity error
    ready.
    ——————————————————————————————————————————————————–
    Editor

    :L

    1 *
    2 * PRINTIT
    3 *
    4 ORG $8000
    5 CHROUT EQU $FFD2
    6 LDA #$58
    7 JSR CHROUT
    8 RTS

    Any help would be sincerely appreciated. I much prefer the 80 column availability on the 128 but it seems ‘quirky’ almost to the point of being unusable.

    Thank you!

Leave a Reply