BASEC v0.20 Command Summary --------------------------- The BASIC Emulation Compiler is programmed by William Yu (c)1998-99 Please read and understand the GPL (GNU Public License) that applies to this distribution (bec-020b) and source codes (bec-v020s). E-mail: voxel@edmc.net Http: http://www.basicguru.com/abc/basec.html About Parser ------------ BEC.EXE was compiled and developed under DJGPP. This parser only completes a single pass, all variables not declared are declared "in place." This approach may cause problems if you're in a loop, but usually only with strings... You can use VAR.LST (the undeclared variable list that's generated) and append this to your source code for better stability. ANSI.LIB, etc. were compiled using DJGPP v2.8.1. The source code compiles under other compilers, but does not always produce the correct results. ie. using 16-bit C compilers Special Thanks -------------- Allegro library v3.0 by Shawn Hargreaves Amp MPEG audio decoder by Tomislav Uzelac JPEG Library courtesy of Tom Lane, Philip Gladstone, Luis Ortiz, Jim Boucher, Lee Crocker, Julian Minguillon, George Phillips, Davide Rossi, Ge' Weijers, and other members of the Independent JPEG Group. Valid Data Types ---------------- BYTE ? 1 0 to 255 WORD ?? 2 0 to 65,535 INTEGER % 2 -32,768 to 32,767 DWORD ??? 4 0 to 4,294,967,295 LONG & 4 -2,147,483,648 to 2,147,483,647 SINGLE ! 4 ñ8.43x10^-37 to ñ3.37x10^38 DOUBLE # 8 ñ4.19x10^-307 to ñ1.67x10^308 EXT ## 10 ñ3.4x10^-4932 to ñ1.2x10^4932 STRING $ 32,767 STRING*n 65,535 Valid Arrays ------------ At the moment, the data type MUST be specified DIM Number(-100 to 100) AS INTEGER DIM Astring(1000) AS STRING DIM A$(1000) ' doesn't work, it needs "AS STRING" Valid Labels ------------ Line numbers with decimal points are valid Example: 100.5 PRINT "Hello world!" But, we usually use the colon to define a label Example: Label1: PRINT "This is a valid label!" Label2: Separating Lines ---------------- Lines can be separated by using a colon Example: ?"Hi!":?"Hi again!":?"Hi yet again!" To continue a line, add the underscore ('_') character at the end Example: PRINT "Hi, my name is " + _ "Cool Guy!" Error Checking -------------- I plan on wiping error messages completely with the '-whocares' switch. Some error correction is done without the user knowing. For example, Error: Overflow will never occur, but the result will, obviously, not be what you want if that is the case. The error messages you receive may not always be understandable... ie. ?:INPUT$(1) gives an "improper placement of quotation mark" error. PRINT 123456% would normally receive an illegal number in QB DIM A$(1000) AS STRING would also receive an error PRINT 100/0 should return a divide error, but doesn't SWAP A!, A% should return type mismatch, but doesn't BASEC Library (extension of ANSI library) ----------------------------------------- LOG10, GET$(1) ANSI Library ------------ $LIB - N/A - You can explicitly tell the compiler to use certain libraries. ANSI.LIB, DOS.LIB, GRAPHICS.LIB, MM.LIB, UNIX.LIB $STRING - N/A - Defines the default length of string used - The default is 255, the maximum is 32767 - Do not use 32K, instead write 32767 or 1024 for 1K strings - No expressions like 32 * 1024, just an integer value is accepted ABS(n) - Function returns the absolute value of integer expression n - see also SQR ASC(n) - Function returns the ASCII value of the character - see also CHR$ CHR$(n) - Function returns the character of ASCII value n - see also ASC CINT(numeric-expression) - Conversion function that returns the rounded integer expression CDBL(numeric-expression) - Converts expression to a double precision number CLNG(numeric-expression) - Converts expression to a long number CSNG(numeric-expression) - Converts expression to a single precision number CLOSE [filenum [, filenum]] - If arguments are omitted, then all open files are closed - see also OPEN COS(n) - Function that returns the cosine of n (in radians) - see also SIN, TAN DATA - Used to store numeric and string constands used by the READ statement. - see also READ, RESTORE DIM AS [*][Length] - any legal variable name (max 80 characters) - Underscores are legal (ie. My_Name) - if string, you have an option of defining its length size DO...LOOP [UNTIL ] - Control block that loops until expression returns true - UNTIL is optional EOF(filenum) - Test file for End-of-file - Returns a non-zero value if the file is at the end. END IF - Must be used to end a multiple line IF ... THEN ... ELSE block - see also IF ENVIRON$(environ-string) - Function returns the value of the environment variable - ie. ENViRON$("PATH") returns the entire PATH - Returns a string EXP(n) - Exponential Function, returning the value of e raised to the power n - see also LOG, LOG10 FIX(numeric-expression) - Returns the whole number (truncating any fractions). FOR i=start TO end [STEP n]...NEXT - Control flow block that repeats a number of statements - ie. FOR i = start to end [STEP n] - see also STEP FREEFILE - Returns the next free file pointer that can be used. - The range is between 1-100 - see also OPEN GET filenum, [filepos], variable - Reads from file to a buffer or variable - File must be open of course - filepos = 1 (the beginning of the file) - see also OPEN GET$(n) - Function is similar to LINE INPUT or INPUT$ in both respects - It reads whole lines and doesn't end until n characters are received - In v0.20 GET$ ends on ENTER or EOF - see also DOS_Library INPUT$ GOSUB