




















                    *************************************
                    *                                   *
                    * MBASIC version 1.01               *
                    * Copyright (C) 1992 by Andre Murta *
                    *                                   *
                    *************************************



























**************************************
*** MBASIC Statements and Operands ***
**************************************

******************
*** Statements ***
******************
PRINT [NONEWLINE]
FPRINT #
INPUT
FINPUT #
IF THEN ELSE
GOTO
FOR TO DOWNTO STEP NEXT
GOSUB RETURN
WHILE WEND
REM
LET
DIM
CLS [LINE] (HW dependent)
RANDOMIZE
DATA
READ
DEFFN
LOCATE (HW dependent)
COLOR (HW dependent)
TEXTMODE [25, 28, 35, 40, 43, 50] (HW dependent)
FILES (HW dependent)
INSLINE (HW dependent)
DELLINE (HW dependent)
CHAIN
HIGHVIDEO (HW dependent)
NORMVIDEO (HW dependent)
LOWVIDEO (HW dependent)
CLEAR
FLASH
WINDOW
OPEN [READING, WRITING, APPENDING, RANDOM, SEQUENTIAL]
CLOSE
FIELD
PUT
GET
SEEK
END

*** SEE REFERENCE GUIDE FOR MORE INFO ABOUT MBASIC STATEMENTS ***

****************
*** Operands ***
****************
= (equal)            && (and)      + (addition)          $ (string pointer)
> (bigger than)      || (or)       - (subtraction)       : (mimics an <enter>)
< (less than)                      * (multiply)
<> (not equal)                     / (divide)
>= (bigger equal)                  ^ (power)
<= (less equal)
*********************************
*** MBASIC Internal Functions ***
*********************************

Function        Return type
---------------------------
    "chr"       STRING,
    "asc"       NUMERIC,
    "len"       NUMERIC,
    "inkey"     NUMERIC, /* HW dependent*/
    "left"      STRING,
    "mid"       STRING,
    "right"     STRING,
    "sqr"       NUMERIC,
    "log"       NUMERIC,
    "exp"       NUMERIC,
    "sin"       NUMERIC,
    "cos"       NUMERIC,
    "tan"       NUMERIC,
    "atn"       NUMERIC,
    "pi"        NUMERIC,
    "abs"       NUMERIC,
    "sgn"       NUMERIC,
    "int"       NUMERIC,
    "timer"     NUMERIC, /* HW dependent */
    "val"       NUMERIC,
    "str"       STRING,
    "lcase"     STRING,
    "ucase"     STRING,
    "time"      STRING,
    "date"      STRING,
    "asin"      NUMERIC,
    "acos"      NUMERIC,
    "sinh"      NUMERIC,
    "cosh"      NUMERIC,
    "tanh"      NUMERIC,
    "log10"     NUMERIC,
    "floor"     NUMERIC,
    "rnd"       NUMERIC,
    "etype"     NUMERIC,
    "chdir"     NULL, NUMERIC,
    "rmdir"     NUMERIC,
    "mkdir"     NUMERIC,
    "col"       NUMERIC, /* HW dependent */
    "row"       NUMERIC, /* HW dependent */
    "cols"      NUMERIC, /* HW dependent */
    "rows"      NUMERIC, /* HW dependent */
    "stack"     NUMERIC, /* HW dependent */
    "copytext"  NUMERIC, /* HW dependent */
    "rename"    NUMERIC,
    "kill"      NUMERIC,
    "loc"       NUMERIC,
    "lof"       NUMERIC,
    "eof"       NUMERIC,
    "instr"     NUMERIC,
    "spc"       STRING,
    "tab"       STRING, /* HW dependent */
    "asinh"     NUMERIC,
    "acosh"     NUMERIC,
    "atnh"      NUMERIC,
    "atn2"      NUMERIC,
    "log2"      NUMERIC,
    "ceil"      NUMERIC,
    "fmod"      NUMERIC,
    "hypot"     NUMERIC,
    "pow"       NUMERIC,
    "pow10"     NUMERIC,
    "pow2"      NUMERIC,
    "gettext"   STRING,  /* HW dependent */

*** SEE THE REFERENCE GUIDE FOR MORE INFO ABOUT MBASIC FUNCTIONS ***

************************************************************
*** Particularities compared to other BASIC interpreters ***
************************************************************

***************
***** DIM *****
***************
Arrays can have up to three dimensions

DIM a(5)
DIM b(5,5)
DIM c(5,5,5)

The DIM statement cannot be used to declare more than one array variable, for
example, the program line:

DIM a(5), b(5,5), c(10)

will result in an syntax error. Such declarations should be:

DIM a(5)
DIM b(5,5)
DIM c(10)

Array variables cannot be passed as function parameters, for example:

DIM a(5)

REM ***** WRONG!!!!! *****
PRINT 2 + user_defined_function(a, var2, var3)

REM ***** THAT'S OK *****
PRINT 2 + user_defined_function(a(1), var2, var3)

Arrays in MBASIC can keep multitype values, for example:

DIM arr(3)
arr(1) = 10
arr(2) = "This is a text"
arr(3) = 20.45

The code above is perfectly valid, the array "arr" will keep 3 items, two of
them are numeric (index 1 and 3) the item stored at the index 2 is a string
value.

*********************
***** DATA,READ *****
*********************
The command READ cannot associate variables. This means if you want to READ
information from memory you must DATA it first, for example:

05 REM this code is *****INVALID*****
10 PRINT "something"
20 READ a,b
30 DATA 10,20
40 PRINT a,b
50 END

You must use the command DATA before use the command READ

05 REM this code is *****VALID*****
10 PRINT "something"
20 DATA 10,20
30 READ a,b
40 PRINT a,b
50 END

This is fact is due to the fact the MBASIC pre parser does not treat DATA
commands yet. It could be maybe available in future versions of MBASIC.


****************************
***** String variables *****
****************************
The dollar sign which is mandatory to STRING variables in regular BASIC
interpreters does not exist in MBASIC, for example:

PRINT "This program details about dealing"
PRINT "with STRING vars in MBASIC"
DATA 10,"This is a string"
READ a,b
REM next line will print '10'
PRINT a
REM next line will print 'This is a string'
PRINT b
c = " concatenation"
d = b + c
REM next line will print 'this is a string concatenation'
PRINT d

It's important to note that string constants and variables in MBASIC cannot
superseed the maximum length of 255 characters.


*****************************
***** Numeric variables *****
*****************************
Numeric variables in MBASIC represented as real numbers, must have both the
integer and fractional part. ALWAYS!!! For example.

C = A + B + .5 : REM Is ***** INCORRETCT *****

you must use:

C = A + B + 0.5 : REM That's ok to the interpereter.


***** Line Numbers *****
************************
The program lines in MBASIC do not need to start with a number, in fact,
only the label lines must start with a number to be referenced by the
commands GOTO and GOSUB.

    count = 0
 10 PRINT "count = ";count
    count = count + 1
    IF count < 5 THEN GOTO 10
    PRINT "Finito!!!"
    END


***************
***** LET *****
***************
- The LET command is optional in MBASIC as well as in many BASIC language
implementations.

LET var = 2 * (2+2)

is the same as

var = 2 * (2+2)


****************************
***** IF / THEN / ELSE *****
****************************
The IF / THEN / ELSE statements, must have a GOTO or GOSUB clause following
them, if the user intends to execute program jumps after the tests. If the
user declares only the label number after the test, it will result in a
syntax error. For example:

REM ********** WRONG!!!!!!! **************
a = 10
IF a > 2 THEN 200
...
200 PRINT "variable 'a' is bigger than two."
...

REM ********** CORRECT!!! ****************
a = 10
IF a > 2 THEN GOTO 200
...
200 PRINT "variable 'a' is bigger than two."
...
