![]()
|
8085 Basic Compiler Reference Manual
The list of all Basic compiler keywords: Default extension for basic source files is BAS. The compiler output is assembler source file (with ASM extension) that can be translated to binary code using integrated assembler. Smart editor marks all reserved keywords in different color, that simplifies debugging process.
Three data types are supported:
Variables are declared using DIM statement:
It is also possible to use one-dimensional arrays. For example:
It is possible to make conversions between Short and Integer data type
by simple assignment statements:
Constants can be used in decimal number system with no special marks,
in hexadecimal number system with leading 0x notation (or with H at the
end) and in binary system with leading % mark (or with B at the end).
Keywords True and False are also available for Boolean type constants.
For example:
Constants can also be assigned to symbolic names using CONST
directive:
Five arithmetic operations (+, -, *, /, MOD) are supported. It is possible
to make only one arithmetic operation in one single statement.
Arithmetic operations are allowed only in assignment statements and all
variables in one such statement must be the same data type. For
example:
For Boolean and Short data type variables seven basic logical
operations are supported. It is possible to make only one logical
operation in one single statement. Logical operations are allowed only in
assignment statements. For example:
The GOTO statement uses line label name as argument. Line labels
must be followed by colon mark ":". For example:
Three standard BASIC statements are supported:
FOR-TO-STEP-NEXT, WHILE-WEND and IF-THEN-ELSE-ENDIF.
In FOR-TO-STEP-NEXT statement all variables must be Integer
data type. Here are several examples:
IF statements that are not used for conditional branching must always be used in connection with ENDIF, even if there is only one statement to be executed if the condition is satisfied. If there are statements following THEN in the same line an error is generated. Only GOTO statement (or just line label name) may be placed in the same line after THEN statement. There are no limits for the number of nested statements of any kind.
Standard BASIC elements for accessing memory are available: POKE
statement and PEEK function. They can be used with integer constants
and also with variables of Short or Integer data type. For example:
SETBIT and RESETBIT statements can be used to set or reset the
individual bits in Short data type variables. The first argument is a Short
variable that will be the target of the operation, and the second
argument is target bit number and it must be a constant in the range 0-7.
The communication with the outside world is done using GET function
and PUT and PRINT statements. The argument of the GET function is
port number and must be a constant value in the range [0-255]. It can
be used to assign the value received on the port to a variable of Short
or Integer data type. For example:
PUT statement can be used to send data to the specified port. The
data can be a constant value in the range [0-255] or contained in a
variable of Short or Integer data type. Only the lowest byte of the
variable is sent to the port. For example:
PRINT statement can be used in three different ways. It is possible to
use it to send a constant string , to send a variable of any supported
data type or to send the LF (Line Feed) character or CRLF (Carriage
Return - Line Feed) sequence to the specified port. Here is an example:
This can also be done using only one PRINT statement:
Structured programs can be written using subroutine calls with GOSUB
statement that uses line label name as argument. Return from a
subroutine is performed by RETURN statement. User need to take care
that the program structure is consistent. When using subroutines, main
routine need to be ended with END statement. Here is an example:
It is possible to use comments in basic source programs. The comments must begin with single quote symbol (') and may be placed anywhere in the program. BASIC compiler has no optimization abilities. Although it can be used for development projects, its main purpose is educational. Its assembler output has all necessary comment lines, that will help user understand how high-level BASIC statements are compiled to low-level assembly language, ready for execution by 8085 CPU. |