intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF (EN)

int e l 1.4 DEFINITION OF TERMS VARIABLES: In Version 1.0 of MCS BASIC-52 a variable could be defined as either a letter, (i.e. A, X, I), a letter followed by a number, (i.e. Q1, T7, L3), a letter followed by a ONE DIMENSIONED expression, (i.e. J(4), G(A+6), I(10*SIN(X))), or a letter followed by a number followed by a ONE DIMENSIONED expression (i.e. A1(8), P7(DBY(9)), W8(A+B). In Version 1.1 variables can be defined in the same manner as in Version 1.0, however variables may also contain up to 8 letters or numbers including the underline character. This permits the user to use a more descriptive name for a given variable.

Examples of valid variables in Version 1.1 of MCS BASIC-52 are as follows: FRED VOLTAGE1 I – 11 ARRAY(ELE_1) When using the expanded variable names available in Version 1.1 of MCS BASIC-52 it is important to note that 1) It takes longer for MCS BASIC-52 to process these expanded variable names and 2) The user may not use any keyword as part of a variable name (i.e. the variables TABLE and DIET could not be used because TAB and IE are reserved words). BAD SYNTAX ERRORS will be generated if the user attempts to define a variable that contains a reserved word. Variables that include a ONE DIMENSIONED expression [expr] are often referred to as DIMENSIONED or ARRAYED variables.

Variables that only involve a letter or a letter and a number are called SCALAR variables. The details concerning DIMENSIONED variables are covered in the description of the STATEMENT ROUTINE DIM. This document will refer to VARIABLES as: [var]. MCS BASIC-5 allocates variables in a "static" manner. That means each time a variable is used, BASIC allocates a portion of memory (8 bytes) specifically for that variable. This memory cannot be de-allocated on a variable by variable basis. That means if you execute a statement like Q = 3, later on you cannot tell BASIC that the variable Q no longer exists so, please "free up" the 8 bytes of memory that belong to Q. Sorry. it doesn't work this way.

The only way the user can clear the memory that is allocated to variables is to execute a CLEAR STATEMENT. This Statement "frees" all memory allocated to variables. IMPORTANT NOTE: Relative to a dimensioned variable, it takes MCS BASIC-52 a lot less time to find a scalar variable. That's because there is no expression to evaluate in a scalar variable. So, if you want to make a program run as fast as possible, use dimensioned variables only when you have to. Use scalars for intermediate variables, then assign the final result to a dimensioned variable. EXPRESSIONS: An expression is a logical mathematical formula that involves OPERATORS (both unary and dyadic), CONSTANTS, and VARIABLES.

Expressions can be simple or quite complex, i.e. 12*EXP(A)/100, H(I)+55, or (SIN(A)*SIN(A)+COS(A)*COS(A))/2. A "stand alone" variable [var] or constant [const] is also considered an EXPRESSION. This document will refer to EXPRESSIONS as: [expr] . - 6 -