CBASIC in General CBASIC Compile-Time Toggled Options Compiler Error Messages Run-Time Error Messages -- Warnings Run-Time Error Messages -- Error Codes CBASIC Reserved Words :CBASIC: CBASIC in General CBASIC is a compiler BASIC which may be executed on any floppy disk based CP/M system having at least 20K bytes of memory. In order to make the best use of the power and flexibility of CBASIC, a dual floppy disk system and at least 32K of memory is recommended. If CBASIC is executed in a system smaller than 20K, a CP/M LOAD ERROR may occur. The CBASIC system consists of two programs -- CBASIC and CRUN. CBASIC is the compiler, and CRUN is the run-time intepreter. In a typical CBASIC session, the user will write the program using ED, compile it using CBASIC (with the $B option to suppress listing), and run it using CRUN. Refer to the 84-page CBASIC manual -- C B A S I C A Commercially Oriented Compiler/Interpreter BASIC Language Facility for CP/M Systems February 17, 1978 :CBASIC: CBASIC Compile-Time Toggled Options Compiler toggles are a series of switches that can be set when the compiler is executed. The toggles are set by typing a dollar-sign ($) followed by the letter designations of the desired toggles starting one space or more after the program name on the command line. Toggles may only be set for the compiler. Examples of compiler toggles and invocation forms are -- CBASIC INVENTRY $BGF B:CBASIC A:COMPARE $GEC CBASIC PAYROLL $B CBASIC B:VALIDATE $E CBASIC Compiler Toggles TOGGLE B: Suppresses the listing of the program on the console during compilation. If an error is detected, the source line with the error and the error message will be printed even if Toggle B is set. Toggle B does not affect listing to the printer (Toggle F) or disk file (Toggle G). Toggle B is initially off. TOGGLE C: Suppresses the generation of an INT file. Engaging this toggle will provide a syntax check without the overhead of writing the intermediate file. Toggle C is initially off. TOGGLE D: Suppresses translation of lower-case letters to upper-case. For example, if Toggle D is on, 'AMT' will not refer to the same variable as 'amt'. Toggle D is initially off. TOGGLE E: Causes the run-time program (CRUN) to accompany any error messages with the CBASIC line number in which the error occurred. Toggle E must be set in order for the TRACE option (see section 13.4 of the manual) to work. Toggle E is initially off. TOGGLE F: Causes the compiler output listing to be printed on the LST: device in addition to the system console. Toggle F is initially off. TOGGLE G: Causes the compiler output listing to be written to diskette. The file containing the compiler listing has the same name as the .BAS file, but its type is .LST. Toggle G is initially off. :CBASIC: Compiler Error Messages Text Messages NO SOURCE FILE: .BAS The compiler could not locate a source file used in either a CBASIC command or an INCLUDE directive. PROGRAM CONTAINS n UNMATCHED FOR STATEMENT(S) There are n FOR statements for which a NEXT could not be found. PROGRAM CONTAINS n UNMATCHED WHILE STATEMENT(S) There are n WHILE statements for which a WEND could not be found. WARNING: INVALID CHARACTER IGNORED The previous line contains an invalid ASCII character; this character is ignored by the compiler, and a question mark is printed in its place. 2-Letter Error Codes CE -- Close Error The intermediate (.INT) file could not be closed. DE -- Disk Error A disk error occurred while trying to read the .BAS file. DF -- Disk Full There was no space on the disk or the disk directory was full. The .INT file was not created. DL -- Duplicate Line number The same line number was used on two different lines. Other compiler errors may cause a DL error message to be printed even if duplicate line numbers do not exist. DP -- Defined Previously A variable in a DIM statement was previously defined. EF -- Exponential Format A number in exponential format was input with no digits following the E. FD -- Function Definition A function name that has been previously defined is being redefined in a DEF statement. FI -- FOR Index An expression which is not an unsubscripted numeric variable is being used as a FOR loop index. FN -- Function parameter Number A function reference contains an incorrect number of parameters. FP -- Function Parameter type A function reference parameter type does not match the parameter type used in the function's DEF statement. FU -- Function Undefined A function has been referenced before it has been defined. IE -- IF Expression An expression used immediately following an IF evaluates to type string. Only type numeric is permitted. IF -- In File A variable used in a FILE statement is of type numeric where type string is required. IP -- Input Prompt An input prompt string is not surrounded by quotes. IS -- Invalid Subscript A subscripted variable was referenced before it was dimensioned. IU -- Invalid Use A variable defined as an array is used with no subscripts. MF -- Mixed Format An expression evaluates to type string when type numeric is required. MM -- Mixed Mode Variables of type string and type numeric are combined in the same expression. NI -- NEXT Index A variable referenced by a NEXT statement does not match the variable referenced by the associated FOR statement. NU -- NEXT Unexpected A NEXT statement occurs without an associated FOR statement. OO -- ON Overflow More than 25 ON statements were used in the program. SE -- Syntax Error The source line contains a syntax error. SN -- Subscript Number A subscripted variable contains an incorrect number of subscripts. SO -- Syntax Overflow The expression is too complex and should be simplified and placed on more than one line. TO -- Table Overflow The program is too large for the system. The program must be simplified or the system size increased. UL -- Undefined Line number A line number that does not exist has been referenced. US -- Undefined String A string has been terminated by a carriage return rather than quotes. VO -- Variable Overflow Variable names are too long for one statement. This should not occur. WE -- WHILE Error The expression immediately following a WHILE statement is not numeric. WU -- WHILE Undefined A WEND statement occurs without an associated WHILE statement. :CBASIC: Run-Time Error Messages -- Warnings Two textual run-time error messages are presented by CRUN: NO INTERMEDIATE FILE A file name was not specified with the CRUN command, or no file of type .INT and the specified file name was found on disk. IMPROPER INPUT - REENTER This message occurs when the fields entered from the console do not match the field specified in the INPUT statement. This can occur when field types do not match or the number of fields entered is different from the number of fields specified. All fields specified by the INPUT statement must be reentered. 2-Letter Warning Codes DZ -- Divide by Zero A number was divided by zero. The result is set to the largest valid CBASIC number. FL -- Field Length A field length greater than 255 bytes was encountered during a READ LINE. Only the first 255 characters of the record are retained. LN -- Logarithm error The argument given in the LOG function was zero or negative. The value of the argument is returned. NE -- NEgative number A negative number was specified following the raise to a power operator (^). The absolute value is used in the calculation. OF -- OverFlow A calculation produced a number too large. The result is set ot the largest valid CBASIC number. SQ -- SQuare root error A negative number was specified in the SQR function. The absolute value is used. :CBASIC: Run-Time Error Messages -- Error Codes AC -- AsCii error The string used as the argument in an ASC function evaluated to a null string. CE -- Close Error An error occurred upon closing a file. CU -- Close Undefined file A close statement specified a file number that was not active. DF -- Defined File An OPEN or CREATE was specified with a file number that was already active. DU -- Delete Undefined file A DELETE statement specified a file number that was not active. DW -- Disk Write error An error occurred while writing to a file. This occurs when either the directory or the disk is full. EF -- End of File A read past the end of file occurred on a file for which no IF END statement has been executed. ER -- Error in Record An attempt was made to write a record of length greater than the maximum record size specified in the associated OPEN, CREATE, or FILE statement. FR -- File Rename An attempt was made to rename a file to an existing file name. FU -- File Undefined An attempt was made to read or write to a file that was not active. IR -- Invalid Record number A record number less than one was specified. LW -- Line Width A line width less than 1 or greater than 133 was specified in an LPRINTER WIDTH statement. ME -- MAKE Error An error occurred while creating or extending a file because the disk directory was full. MP -- MATCH Parameter The third parameter in a MATCH function was zero or negative. NF -- Number of FILE The file number specified was less than 1 or greater than 20. NM -- No Memory There was insufficient memory to load the program. NN -- No Number field An attempt was made to print a number with a PRINT USING statement but there was not a numeric data field in the USING string. NS -- No String field An attempt was made to print a string with a PRINT USING statement but there was not a string field in the USING string. OD -- Overflow Data A READ statement was executed with no DATA available. OE -- OPEN Error An attempt was made to OPEN a file that didn't exist and for which no IF END statement had been previously executed. OI -- ON Index The expression specified in an ON ... GOSUB or an ON ... GOTO statement evaluated to a number less than 1 or greater than the number of line numbers contained in the statement. OM -- Overflow Memory The program ran out of memory during execution. QE -- Quote Error An attempt was made to PRINT to a file a string containing a quotation mark. RE -- READ Error An attempt was made to read past the end of a record in a fixed file. RG -- RETURN with no GOSUB A RETURN occurred for which there was no GOSUB. RU -- Random Undefined A random read or print was attempted to other than a fixed file. SB -- SuBscript An array subscript was used which exceeded the boundaries for which the array was defined. SL -- String Length A concatenation operation resulted in a string of more than 255 bytes. SS -- SubString error The second parameter of a MID$ function was zero or negative. TF -- Too many Files An attempt was made to have more than 20 active files simultaneously. TL -- TAB Length A TAB statement contained a parameter less than 1 or greater than the current line width. UN -- UNdefined edit string A PRINT USING statement was executed with a null edit string. WR -- WRite error An attempt was made to write to a file after it had been read, but before it had been read to the end of the file. :CBASIC: CBASIC Reserved Words CBASIC Reserved Words ABS EQ LEN POS STOP AND EXP LET PRINT STR$ AS FEND LINE RANDOMIZE SUB ASC FILE LOG READ TAB ATN FOR LPRINTER RECL TAN CALL FRE LT REM THEN CHR$ GE MATCH REMARK TO CLOSE GO MID$ RENAME USING CONSOLE GOSUB NE RESTORE VAL COS GOTO NEXT RETURN WEND CREATE GT NOT RIGHT$ WHILE DATA IF ON RND WIDTH DEF INP OPEN SGN XOR DELETE INPUT OR SIN DIM INT OUT SIZE ELSE LE PEEK SQR END LEFT$ POKE STEP  .