RTR logo

BBC BASIC for Windows

Error Messages and Codes



Editor and compiler errors

The following error messages can be reported by the program editor, compiler and Integrated Development Environment:

Cannot allocate clipboard memory

There was insufficient memory to copy something to the clipboard. This should not happen in normal circumstances.

Cannot allocate virtual memory

The requested initial user memory could not be allocated. Try freeing up memory by closing other programs.

Cannot allocate memory for file

A file specified in a REM!Resource compiler directive could not be buffered in memory. This should not happen in normal circumstances.

Cannot append program

The Compile utility could not append your program to the executable file. Most likely the disk is full.

Cannot create character map

There was insufficient memory for the screen character map. This should not happen in normal circumstances.

Cannot create file

The specified file could not be created. Either the disk is full, a read-only or locked file of the same name exists, or you do not have write access to the relevant directory (folder).

Cannot create palette

The colour palette could not be created. This should not happen in normal circumstances.

Cannot create screen bitmap

There was insufficient memory for BASIC's screen bitmap. Try freeing up memory by closing other applications; if that fails, reboot your computer.

Cannot create temporary buffer

The memory required for a temporary buffer used during compilation could not be allocated. This should not happen in normal circumstances.

Cannot crunch file

The specified embedded file could not be crunched. To find out why not, try compiling it separately using the same crunch options.

Cannot determine encoding

The character encoding of the program being loaded could not be determined, for example both ANSI and UTF-8 strings appear to be present; the required selection should be made manually. This warning will not be issued again if the program is re-loaded.

Cannot embed file

The Compile utility could not embed a specified resource file in the executable. Most likely the disk is full.

Cannot find BBCTUTOR.CHM

The Tutorial command could not locate the tutorial file BBCTUTOR.CHM. If necessary re-install BBC BASIC for Windows from your master disk.

Cannot find BBCWIN.CHM

The Help Topics command could not locate the help file BBCWIN.CHM. If necessary re-install BBC BASIC for Windows from your master disk.

Cannot find icon in file

The selected icon could not be found in the specified file.

Cannot find manifest

The Windows XP™ Visual Styles manifest could not be read. Suspect a corrupted BBCWIN.EXE or BBCWIN6.EXE file.

Cannot open clipboard

The clipboard could not be opened. This should not happen in normal circumstances.

Cannot open file

The specified file could not be opened. Most likely it does not exist in the specified place or you don't have read access to the relevant directory (folder).

Cannot open icon file

The file containing the selected icon could not be opened. Most likely it does not exist in the specified place or you don't have read access to the relevant directory (folder).

Cannot open temporary file

The specified temporary file could not be opened. Most likely it does not exist in the specified place or you don't have the necessary access rights.

Cannot print program

An attempt to print your program failed.

Cannot process resource in file

A file specified in a REM!Resource compiler directive contains an invalid resource that could not be added to the executable.

Cannot read file

The specified file could not be read. Suspect a corrupted or damaged disk.

Cannot read icon file

The file containing the selected icon could not be read. Suspect a corrupted or damaged disk.

Cannot read icon image from file

The selected icon resource could not be read. Suspect a corrupted or damaged file.

Cannot run Sign Tool

The code-signing utility could not be run; most likely the path or filename specified in the registry is incorrect. The relevant key is: HKCU\Software\R T Russell\BBC BASIC for Windows\Settings\SignTool

Cannot update resources in file

The resources (e.g. icon) of the specified file could not be updated. Either the file does not exist, has the wrong format or could not be opened for writing.

Cannot write file

The specified file could not be written. Most likely the disk is full.

Cannot write icon

The Compile utility could not store the selected icon in the executable file. Most likely the disk is full.

Crunch failed: assembler syntax error

The crunch option of the Compile utility encountered a syntax error within some assembly language code.

Crunch failed: bad variable name

The crunch option of the Compile utility encountered a bad assembler label, for example ..label (two dots).

Crunch failed: calculated line number

The crunch option of the Compile utility encountered a calculated line number, e.g. GOTO (100+offset%). If you use calculated line numbers you must deselect the Concatenate lines option.

Crunch failed: invalid fast variable

The crunch option of the Compile utility encountered a REM!Fast compiler directive specifying an invalid variable name, for example containing an illegal character.

Crunch failed: invalid keep variable

The crunch option of the Compile utility encountered a REM!Keep compiler directive specifying an invalid variable name, for example with fewer than three characters.

Crunch failed: missing \

The crunch option of the Compile utility detected a line continuation character without another at the beginning of the next line.

Crunch failed: mismatched quotes

The crunch option of the Compile utility detected mismatched quotation marks ("). There must always be an even number in the line.

Crunch failed: statement not at start of line

The crunch option of the Compile utility detected an ENDCASE, ENDIF, OTHERWISE or WHEN not at the start of a line.

Directory was changed

When selecting files for embedding in an executable (Compile utility) the directory was changed. Only files in the @dir$ or @lib$ directories, or their subdirectories, can be embedded.

File is not a valid resource file

A file specified in a REM!Resource compiler directive does not have the correct signature for a .res format file.

HTML Help not installed

The Help Topics or Tutorial command could not access the HTML Help system. On Windows™ 95 and NT 4.0 you may need to install Internet Explorer version 4 or later to rectify this error.

Insufficient memory

There is insufficient memory to CHAIN a program file, or to change the value of PAGE.

Insufficient memory to crunch file

There is insufficient memory to crunch the specified embedded file.

Insufficient memory to crunch program

There is insufficient memory to run the crunch option of the Compile utility. Increase the value of HIMEM or change the initial user memory setting and re-start BBC BASIC.

Invalid file format

The program file you are attempting to load does not have a valid tokenised or ASCII format. The file may have been corrupted.

Line too long

An attempt to concatenate two program lines, by typing backspace when the cursor is at the beginning of the line, would cause the maximum line length to be exceeded.

Line too long - truncated!

When tokenising a program line, i.e. converting it from ASCII to internal format, the maximum line length was exceeded and the remainder of the line was discarded. This can happen when loading a program from a file or when typing (or pasting) it in.

Not enough room for file

There is insufficient memory to Load or Insert a file. Increase the value of HIMEM or change the initial user memory setting and re-start BBC BASIC.

Program is too big for allocated memory

There is insufficient memory for your BASIC program. Increase the value of HIMEM or change the initial user memory setting and re-start BBC BASIC.

Sign Tool failed or aborted

The code-signing utility returned a failure status; most likely the parameters specified in the registry are incorrect (where the path/filename of the executable to be signed is given as "%s"), or the authorising server couldn't be contacted. The relevant key is: HKCU\Software\R T Russell\BBC BASIC for Windows\Settings\SignParm

Too many files selected

You have attempted to add too many embedded files in one go. Add the files in smaller groups.


Run-time errors

The following error messages can be reported while your BASIC program is running:

Trappable errors - BASIC

NoError NoError
1Jump out of range 2Size needed
3Multiple label 4Mistake
5Missing , 6Type mismatch
7Not in a function 8Address out of range
9Missing " 10Bad DIM statement
11DIM space 12Not in a FN or PROC
13Not in a procedure 14Bad use of array
15Bad subscript 16Syntax error
17Escape 18Division by zero
19String too long 20Number too big
21Negative root 22Logarithm range
23Accuracy lost 24Exponent range
25Bad MODE 26No such variable
27Missing ) 28Bad hex or binary
29No such FN/PROC    30Bad call
31Incorrect arguments 32Not in a FOR loop
33Can't match FOR 34Bad FOR variable
35STEP cannot be zero 36Missing TO
37Missing OF 38Not in a subroutine
39ON syntax 40ON range
41No such line 42Out of data
43Not in a REPEAT loop 44  WHEN/OTHERWISE not first
45  Missing # 46Not in a WHILE loop
47Missing ENDCASE 48OF not last
49Missing ENDIF 50Bad MOUSE variable
51No such system call 52Bad library
53Size mismatch 54DATA not LOCAL
55Missing \ 56Bad use of structure

Trappable errors - OS

NoError NoError
189Access denied        192Too many open files
196File exists 198Disk full
199Disk fault 201Disk read only
202Device fault 204Bad name
205Bad device 206Bad directory
214File or path not found 222Invalid channel
244No coprocessor 245Device unavailable
246No such font 248No such printer
251Bad key 253 Bad string
254 Bad command 255Unknown error

Untrappable errors

The following untrappable ('fatal') errors have an error code of zero:
No room ON ERROR not LOCAL
Bad program 
Strictly speaking 'Bad program' does not have an error code. It leaves ERR and ERL unchanged.


Access denied

189

This is something of a 'catch all' error message. It originates from Windows™ and occurs whenever the operating system thinks you are trying to illegally write to or delete a file or directory.

The most common case of this error is trying to write to a file that was opened for input with OPENIN. If you wish to write to an existing file, you should open it for read/write with OPENUP.

On a network system, this error may indicate that you are trying to access a file that has been locked by another user. For example, two users trying to open the same file with OPENUP will give rise to this error.

You will also get this error if you try to remove a directory which has files in it. If you wish to remove (delete) a directory you must first delete all the files in it.

Accuracy lost

23

Before BBC BASIC for Windows calculates trigonometric functions (SIN, COS, etc.) of very large angles the angles are reduced to ± PI radians. The larger the angle, the greater the inaccuracy of the reduction, and hence the result. When this inaccuracy becomes unacceptable, BASIC will issue an 'Accuracy lost' error message.

Selecting the *FLOAT 64 mode allows the use of larger angles before an 'Accuracy lost' error is generated.

Address out of range

8

Although BBC BASIC programs should always allocate memory 'properly' (e.g. using the DIM statement or by lowering HIMEM) many programs written for the BBC Micro (and some written for other versions of BBC BASIC) contain references to 'absolute' memory addresses. Such programs would be very likely to crash BBC BASIC for Windows, since the addresses usually aren't valid in Windows™. For this reason, attempts to access memory addresses below &10000 are trapped and result in the 'Address out of range' error rather than a crash.

The address is checked in the case of indirection (i.e. the ?, ! and $ operators), when setting the values of PAGE and LOMEM, in the CALL, SYS and USR statements, and in the *LOAD and *SAVE commands.

This error also results when the assembler detects that the code pointer has reached the specified limit value L%.

Bad call

30

This error indicates that a procedure or function has been called incorrectly, for example by adding a space between the keyword FN and the function name:

PRINT FN mean(5,6)
DEF FNmean(A,B) = (A + B) / 2

Bad command

254

This error occurs when a 'star' (OSCLI) command is not correctly structured, or when Windows™ cannot understand a filename or file specification. For example, if the memory address is omitted from a *LOAD command, the 'Bad command' error will result.

Note that if a 'star' command is not recognised by BBC BASIC it is passed to Windows™ for execution. Should it not be a valid GUI or console command (for example it was mis-typed) the 'Bad command' error will not be generated but instead the 'Bad command or filename' error will be displayed at the Command Prompt. This is not trappable by a BASIC program, and may appear on the screen only fleetingly, if at all.

Bad DIM statement

10

This error is produced when there is a mistake in a DIM statement. For example, if an array suffix is negative a 'Bad DIM statement' error will result:

DIM table(20,-10)
This error will also result if you attempt to re-dimension an array which has already been declared, or redeclare a structure which has already been declared:
100 DIM A(123)
110 DIM A(100)
120 DIM my_struct{x%,y%}
130 DIM my_struct{A,B}
Note that you can repeat an array or structure declaration so long as the dimensions or format respectively are identical to those specified when the array/structure was first declared. In this case the contents of the array or structure remain unchanged: they are not initialised.

Bad directory

206

This error indicates that Windows™ could not understand a directory (folder) name, for example it contained illegal characters. For example, the command

*CD \:\
would give rise to the 'Bad directory' error.

Bad device

205

This error is reported if Windows™ could not understand a device name.

Bad FOR variable

34

The variable in a FOR...NEXT loop must be a numeric variable. If you use a constant or a string variable this error message will be generated. For example, the following statements are not legal.

20 FOR name$=1 TO 20

20 FOR 10=1 TO 20

Bad hex or binary

28

Hexadecimal numbers can only include the characters 0 to 9 and A to F; similarly binary numbers can only contain the digits 0 and 1. If you try to form a hexadecimal or binary number with other characters this error will occur. For example:

n = &OF
n = %21
(in the first example a letter O was used where the figure 0 was intended).

Bad key

251

This error is generated if the key number in a *KEY command is greater than 24.

Bad library

52

This error occurs if a module loaded with the INSTALL or CALL statement has an incorrect format, i.e. is anything other than a valid BBC BASIC for Windows internal format (tokenised) program file. This is similar to the 'Bad program' error except that 'Bad library' is trappable with ON ERROR but 'Bad program' is not.

Bad MODE

25

This error is generated if an attempt is made to select a MODE number greater than 33.

Bad MOUSE variable

50

This error is generated if one or more variables specified in the MOUSE statement is invalid, for example is a string variable rather than a numeric variable.

Bad name

204

This error is generated if a file specification exceeds 255 characters in length (or would exceed 255 characters after a default extension, e.g. .BBC, is added).

Bad program

When a program is run, or is CHAINed from another program, BBC BASIC for Windows checks to see that it has the correct internal (tokenised) format; if not, the 'Bad program' error is generated.

This error can be caused by attempting to run a file with an inappropriate format (e.g. a program in ASCII text format) or by corrupting the program in memory (machine code programmers beware). 'Bad program' is an untrappable error and does not have an error code (by definition there is no program present which could make use of such a code).

The most likely cause is that the program file is in ASCII (text) or Acorn format, rather than the correct internal (tokenised) format. In that case you can convert the file to the wanted format by Loading it into the program editor and Saving it As a BBC BASIC (.BBC) file.

Bad string

253

File names (etc.) in 'star' (OSCLI) commands may optionally be enclosed in quotes; this is mandatory if the filename includes a space. The 'Bad string' error will occur if the quotes are unmatched. The following example would give rise to this error:

*DEL "GRAPHS
This error is also generated if there is insufficient space for the key string in a *KEY command.

Bad subscript

15

This error is generated if you attempt to access an element of an array whose subscript is negative or greater than the dimension specified in the DIM statement. Both lines 20 and 30 of the following example would give rise to this error:

10 DIM test(10)
20 test(-4)=20
30 test(30)=10

Bad use of array

14

This error occurs when an array is referenced but where the use of an array is inappropriate, or when an undimensioned array is referenced (for example after an array is made LOCAL or PRIVATE but before it is re-DIMensioned).

Bad use of structure

56

This error occurs when a structure is referenced but where the use of a structure is inappropriate, or when an undeclared structure is referenced (for example after a structure is made LOCAL or PRIVATE but before it is redeclared with DIM). The following example would give rise to this error:

DIM mystruct{x,y,z}
mystruct{} = 1

Can't match FOR

33

This error is generated when BBC BASIC for Windows is unable to find a FOR statement corresponding to the current NEXT statement. BBC BASIC will 'pop' FOR ... NEXT loops in an attempt to match the variable name specified after NEXT, but if no matching FOR is found the 'Can't match FOR' error results. For example:

10 FOR A% = 1 TO 10
20   FOR B% = 1 TO 10
30   NEXT C%
It is also generated if an EXIT FOR var statement is encountered and the specified variable does not match that of an enclosing FOR...NEXT loop.

DATA not LOCAL

54

This error is generated if BBC BASIC for Windows encounters a RESTORE DATA statement but is unable to match it with a corresponding LOCAL DATA statement. This can happen as a result of jumping out of a loop in the meantime.

Note that when LOCAL DATA is used inside a FOR... NEXT, REPEAT... UNTIL or WHILE... ENDWHILE loop, or inside a user-defined function, procedure or subroutine, the data pointer is automatically restored on exit (there is no need to use RESTORE DATA).

Device fault

202

This error is generated if a device (e.g. a disk drive) accessed by BBC BASIC for Windows appears not to be ready. This is most commonly caused by attempting to access a floppy disk when no disk is in the drive, or when the disk is seriously damaged.

Device unavailable

245

This error is generated when an attempt is made to play a MIDI file using the *PLAY command, but there is no suitable MIDI device available, or when the SOUND statement is used and no suitable wave output device is available. This is most commonly caused by the device already being in use (for example as the result of a previous *PLAY command, or when another program is using the sound system) but may also indicate that no suitable sound card is installed. A currently-playing MIDI file can be aborted using SOUND OFF.

If you want to avoid this error, you can incorporate the following code at the start of your program:

SoundOK% = TRUE
ON ERROR LOCAL SoundOK% = FALSE
IF SoundOK% SOUND 1,0,0,1
RESTORE ERROR
This will set the variable SoundOK% to TRUE if it is safe to use the SOUND statement and to FALSE if not. All subsequent SOUND statements in your program should be made conditional on SoundOK% as follows:
IF SoundOK% SOUND ..........

DIM space

11

This error is generated if there is insufficient room for an array or structure when you try to declare it, or if an attempt is made to reserve a negative amount of memory. For example,

DIM A% -2
If there is insufficient room for an array or structure, you may be able to increase the memory available to BBC BASIC for Windows by raising the value of HIMEM. Failing that see the Memory management section for hints on how to reduce memory usage.

Disk fault

199

This error is generated if a fault occurs while accessing a disk. It will occur, for example, if the contents of the disk have been corrupted and a file is unreadable.

Disk full

198

This error will occur if there is insufficient room on the disk for the file being written to it.

Disk read only

201

This error is generated if an attempt is made to write to a disk which is write protected, for example a floppy disk which has had its 'write protect' tab moved to the 'protect' position.

Division by zero

18

Mathematically, dividing by zero gives an infinitely large answer. The computer is unable to understand the concept of infinity (it's not alone) and this error is generated. If there is any possibility that the divisor might be zero, you should test for this condition before carrying out the division. For example:

200 IF divisor=0 THEN PROC_error ELSE...
This error is also generated by the DIV and MOD functions if the second value is zero.

Escape

17

This error is generated by pressing the <Esc> key. You can trap this, and other errors, by using the ON ERROR statement. You can inhibit the generation of the 'Escape' error by using *ESC OFF. The <Esc> key then returns the ASCII value of escape (&1B). *ESC ON restores the default action of the <Esc> key.

Exponent range

24

The EXP function is unable to cope with powers greater than about 88 (in *FLOAT 40 mode) or 709 (in *FLOAT 64 mode), since the result would be larger than the maximum number which can be handled by BBC BASIC for Windows. If you try to use a larger power, this error will be generated.

File exists

196

This error is generated if you try to rename a file, and a file with the new name already exists, or to create a directory, and the specified directory already exists.

File or path not found

214

This error will occur if you try to *COPY, *DELETE (or *ERASE), *DISPLAY, *EXEC, *LIST, *LOAD, *LOCK, *PLAY, *RENAME, *SPOOLON, *TYPE, *UNLOCK, CHAIN or INSTALL a file which does not exist.

It will also occur if you try to *SAVE, *SCREENSAVE or *SPOOL to a file in a directory (folder) which does not exist or is not writable by you (in particular under Windows™ Vista or Windows™ 7).

Finally, it can occur if you try to *CHDIR to a non-existent directory, *RMDIR a non-existent directory or *MKDIR in a directory which doesn't exist or which is not writable by you.

Note that this error is not generated if you try to open the file with OPENIN, OPENOUT or OPENUP. In these cases the function returns the value zero, but no error is generated.

Incorrect arguments

31

This error indicates that too many or too few arguments have been passed to a procedure or function or an invalid formal parameter has been used. See the sub-section on Procedures and Functions for more details.

It is also generated if a SYS statement has too many parameters.

Invalid channel

222

This error is generated if a specified channel number does not correspond to an open file. This may be because the file has been closed, or was never opened successfully, possibly because the OPENIN, OPENOUT or OPENUP function failed.

The 'Invalid channel' error is also generated if PTR# or EOF# is used with a channel opened to a communications port (e.g. a serial port).

Jump out of range

1

This assembly language error is generated if you try to perform a relative (short) jump to a destination which is more than +127 or −128 bytes away. Except in the case of LOOP and JECXZ statements (and their variants), you can solve this problem by specifying a near jump:

jz near label
This error is also generated (rather misleadingly) when an assembly language statement requires an 8-bit (one byte) operand but the value supplied won't fit in 8 bits. For example the statement:
add al,1000
would generate the error, because the decimal value 1000 is too big to fit in a single byte.

Logarithm range

22

Logarithms for zero and negative numbers do not exist. This error is generated if you try to calculate the LOG or LN of zero or a negative number, or raise a negative number to a non-integer power.

Missing ,

5

This error is generated if BBC BASIC for Windows was unable to find a comma where one was expected. The following example would give rise to this error.

20 PRINT TAB(10 5)

Missing "

9

This error message is generated if BBC BASIC for Windows was unable to find a double-quote where one was expected. The following example would give rise to this error.
10 name$="Douglas

Missing )

27

This error is generated if BBC BASIC for Windows was unable to find a closing bracket where one was expected. The following example would give rise to this error.
10 PRINT SQR(num

Missing #

45

This error will occur if BBC BASIC for Windows is unable to find a hash symbol (a pound symbol on some computers) where one was expected. The following example would give rise to this error.
CLOSE 7

Missing \

55

This error will occur if there is no backslash (\) symbol at the beginning of a continuation line. See the Line continuation section for details. The following example would give rise to this error.
FOR I% = 1 TO \
N% : PRINT I% : NEXT
If you receive this error as the result of using backslash as an assembler comment delimiter, change the backslash to a semicolon (;).

Missing ENDCASE

47

This error is generated if BBC BASIC for Windows cannot locate an ENDCASE statement to terminate the current CASE statement.

Missing ENDIF

49

This error is generated if BBC BASIC for Windows cannot locate an ENDIF statement to terminate the current multi-line IF ... THEN statement.

Missing OF

37

This error is generated if BBC BASIC for Windows encounters a CASE statement with the OF keyword missing.

Missing TO

36

This error message is generated if BBC BASIC for Windows encounters a FOR...NEXT loop with the TO part missing.

Mistake

4

This error is generated if a statement does not begin with a keyword, but neither is it an assignment to a variable; in other words BBC BASIC for Windows is unable to make any sense of the statement. This is most likely to result from mistyping a keyword.

Multiple label

3

This error is generated by the assembler if, during the first pass of an assembly (OPT 0, 1, 4, 5, 8, 9, 12 or 13), a label is found to have an existing non-zero value. This is most likely to be caused by the same label being used twice (or more times) in the program.

Negative root

21

This error is generated if BBC BASIC for Windows attempts to calculate the square root of a negative number. It is possible for this error to occur with ASN and ACS as well as SQR.

 90 num=-20
100 root=SQR(num)

No coprocessor

244

This error is generated if a *FLOAT 64 command is executed but no numeric data processor is available. This will only happen with older PCs using an 80386 or 80486SX CPU (without an 80387 or 80487SX coprocessor) since all later PC CPUs contain a numeric data processor as standard.

No room

This untrappable error indicates that all the memory available to BASIC was used up whilst a program was running. You may be able to increase the memory available to BBC BASIC for Windows by raising the value of HIMEM. Failing that see the Memory management section for hints on how to reduce memory usage.

No such FN/PROC

29

This error is generated if BBC BASIC for Windows encounters a function call (FN) or procedure call (PROC) but no function or procedure with that name has been defined (DEF).

It is also generated if an attempt is made to get a pointer to a PROC or FN before any conventional function or procedure calls have been made.

No such font

246

This error is generated if the font name given in a *FONT or *PRINTERFONT command cannot be recognised. In practice Windows™ may choose an alternative (possibly unsuitable) font rather than issuing this error.

No such line

41

This error is generated if BBC BASIC for Windows tries to GOTO, GOSUB, TRACE or RESTORE to a non-existent line number.

No such printer

248

This error is generated if the printer name given in a *PRINTER command cannot be recognised. Printer names are not case sensitive, but otherwise must be precise.

No such system call

51

This error is generated if a Windows™ API function called by name with a SYS statement (or called from assembler code) cannot be recognised. This is most likely to be caused by the function name being mistyped (function names are case-sensitive). Note, however, that only API functions in the following Dynamic Link Libraries may be called by name:

Other DLLs must be loaded explicitly and functions they contain must be called by address rather than by name. For example to call the OleUIChangeIconA function in OLEDLG.DLL:
SYS "LoadLibrary", "OLEDLG.DLL" TO oledlg%
SYS "GetProcAddress", oledlg%, "OleUIChangeIconA" TO chicon%
SYS chicon%, ci% TO uint%

No such variable

26

This error is generated if you try to access the value of a variable which has not yet been created. See the Creation of variables section for details of how variables may be created.

Not in a FN or PROC

12

This error is generated if you try to define a variable as LOCAL or PRIVATE outside of a procedure or function. If you forget to put multi-line function definitions out of harm's way at the end of the program you may get this error message (see the sub-section on Procedures and Functions for more details).

Not in a FOR loop

32

This error is generated if BBC BASIC for Windows encounters a NEXT statement but is unable to match it with a corresponding FOR statement. This can be caused by having 'jumped out of a loop' in the meantime (see the sub-section on Program Flow Control for more details).

It is also generated if an EXIT FOR statement is encountered when not in a FOR...NEXT loop.

Not in a function

7

This error is generated if BBC BASIC for Windows encounters an end-of-function statement (i.e. one beginning with an 'equals' sign) but is not currently within a function. If you forget to put multi-line function definitions out of harm's way at the end of the program you are very likely to get this error message (see the sub-section on Procedures and Functions for more details). This can also be caused by having 'jumped out of a loop' whilst within a function.

Not in a procedure

13

This error is generated if BBC BASIC for Windows encounters an ENDPROC but is not currently within a procedure. If you forget to put multi-line procedure definitions out of harm's way at the end of the program you are very likely to get this error message (see the sub-section on Procedures and Functions for more details). This can also be caused by having 'jumped out of a loop' whilst within a procedure.

Not in a REPEAT loop

43

This error is generated if BBC BASIC for Windows encounters an UNTIL statement but is unable to match it with a corresponding REPEAT statement. This can be caused by having 'jumped out of a loop' in the meantime (see the sub-section on Program Flow Control for more details).

It is also generated if an EXIT REPEAT statement is encountered when not in a REPEAT...UNTIL loop.

Not in a subroutine

38

This error is generated if BBC BASIC for Windows encounters a RETURN statement but is unable to match it with a corresponding GOSUB or ON statement. This can be caused by having 'jumped out of a loop' in the meantime (see the sub-section on Program Flow Control for more details).

Not in a WHILE loop

46

This error is generated if BBC BASIC for Windows encounters an ENDWHILE statement but is unable to match it with a corresponding WHILE statement. This can be caused by having 'jumped out of a loop' in the meantime (see the sub-section on Program Flow Control for more details).

It is also generated if an EXIT WHILE statement is encountered when not in a WHILE...ENDWHILE loop.

Number too big

20

This error is generated if a number is entered or calculated which is too big for BBC BASIC for Windows to cope with. The range of values of a 32-bit integer variable (e.g. a%) is from −2147483648 to +2147483647 and the range of values of a 64-bit integer variable (e.g. a%%) is from −9223372036854775808 to +9223372036854775807.
The range of values of a 40-bit floating-point variable is approximately −3.4E38 to +3.4E38, the range of values of a 64-bit floating-point variable (e.g. a#) is approximately −1.7E308 to +1.7E308 and the range of values of an 80-bit variant variable is approximately −1.1E4932 to +1.1E4932.

OF not last

48

This error is generated if the keyword OF is not the last thing on the line in a CASE statement. OF cannot even be followed by a REMark.

ON ERROR not LOCAL

0

This error is generated if BBC BASIC for Windows encounters a RESTORE ERROR statement but is unable to match it with a corresponding ON ERROR LOCAL statement. This can be caused by having 'jumped out of a loop' in the meantime (see the sub-section on Program Flow Control for more details).

ON range

40

This error is generated if, in an ON GOTO/GOSUB/PROC statement, the control variable was less than one or greater than the number of entries in the ON list, and there was no ELSE option. The first example below will generate an 'ON range' error, whilst the second is correct:

10 num=4
20 ON num GOTO 100,200,300

10 num=4
20 ON num GOTO 100,200,300 ELSE 1000

ON syntax

39

This error is generated if an ON statement is misformed. For example:

20 ON x TIME=0

Out of DATA

42

This error is generated if your program tries to READ more items of data than there are in the DATA list(s). You can use RESTORE to return the data pointer to the first DATA statement (or to a particular line with a data statement) if you wish.

Size mismatch

53

This assembly language error is generated when an inappropriate mixture of 16-bit and 32-bit operands is used in the same instruction. For example whilst the following two instructions are both valid:

mov ax,bx
mov eax,ebx
the following (non-existent) instructions will give rise to the 'Size mismatch' error:
mov ax,ebx
mov eax,bx

Size needed

2

Certain assembly language instructions are ambiguous as to whether a byte (8-bit), word (16-bit) double-word (32-bit) or quad-word (64-bit) value is to be acted upon. In these cases the data size must be explicitly stated as byte, word, dword or qword (or byte ptr, word ptr, dword ptr, qword ptr). For example:

inc byte [ebx]
mov dword [count],0
add word [sum],3
If this is not done, a 'Size needed' error will be generated.

STEP cannot be zero

35

This error is generated if the STEP value in a FOR ... NEXT statement is zero. For example:

FOR N% = 1 TO 10 STEP 0

String too long

19

This error is generated if a string is longer than the allowed maximum, for example the maximum length of a filename or OSCLI (*) command is 255 characters; the maximum length of a string passed to VAL is 65535 characters.

Syntax error

16

This error is generated if a keyword was recognised, but the rest of the statement or function was meaningless or incomplete. It is also generated if an illegal character is encountered in a variable name or value.

Too many open files

192

This error is generated if you try to open more than eight files or four communications ports (with OPENIN, OPENOUT or OPENUP) at any one time. To avoid this error make sure that you CLOSE each file as soon as you have finished with it. See Opening files and Serial input/output for more details.

Type mismatch

6

This error is generated when a number was expected but a string was encountered, or vice-versa. For example:

10 TIME = "Midnight"
20 Length = LEN(A%)
This error can be generated when the actual parameters and the formal parameters of a function or procedure do not correspond (see Procedures and functions for more details).

The Type mismatch error will also result when array arithmetic is performed but the dimensions of the arrays are not compatible.

Unknown error

255

This error is generated if Windows™ reports an error condition which BBC BASIC for Windows does not recognise. You can discover the Windows error number (so long as no other error has occurred in the meantime) as follows:

SYS "GetLastError" TO ern%
PRINT ern%
If you prefer you can convert the error number to a string:
DEF FNerrorstring(ern%)
DIM buf% LOCAL 255
SYS "FormatMessage",&1000,0,ern%,0,buf%,255,0
= $$buf%

WHEN/OTHERWISE not first

44

This error is generated if a WHEN or OTHERWISE clause of a CASE statement does not appear at the very start of a program line.

Left CONTENTS

CONTINUE Right


Best viewed with Any Browser Valid HTML 3.2!
© Richard Russell 2016