📄 basic11.txt
字号:
2.8 Operating Modes:
BASIC11 has two operating modes, the RUN mode and the immediate
Mode. In the RUN mode program lines that have previously been entered
are executed starting with the smallest line number and continues until
a STOP or END statement is executed, an error occurs, or a control-C is
typed on the terminal.
In the immediate Mode, any legal BASIC11 statement or command
may be typed in without a line number and the statement will immediately
be executed. BASIC11 may be used in this mode to debug programs by
examining variables, memory locations, or I/O ports.
2.9 Remarks:
It is a good idea to place remarks throughout your programs so
that someone else can understand the operation of your program if it
ever becomes necessary to change it. It can even help you if you
haven't worked with the program in a while. Even though the REM
statement is not executable it may be referenced by other program
statements (for example, by a GOTO or GOSUB statement).
3.0 Commands:
Commands are instructions to BASIC11 that allow it to perform
"housekeeping" tasks at the users request. None of the following
commands may appear in a BASIC11 program.
NAME EXAMPLE/EXPLANATION
CLEAR CLEAR
The clear command is used to set all variables to zero and to
reset the GOSUB, WHILE, and FOR - NEXT stacks. A clear is automatically
performed when a RUN command is entered.
CONT CONT
The CONT command is used to restart a BASIC11 program either
after it has been stopped by either a STOP statement or a control-C was
typed at the terminal. The program can't be restarted if an error
occurred in the program or if the program is modified.
LIST LIST Lists the entire program
LIST [line #] Lists one line
LIST [line #]-[line #] Lists from the first line number
through the second line number
The LIST command can be used to display selected lines of the
program on the terminal. As can be seen from the above examples, all,
part, or a single line of the program may be listed.
LLIST LLIST
LLIST [line #]
LLIST [line #]-[line #]
The LLIST works in the same manner as the LIST command, except
that the program lines are sent to the system printer instead of the
terminal.
NEW NEW
The NEW command is used to clear out both the BASIC program
buffer and the variable storage space. It prepares BASIC11 to accept a
"New" program.
RUN RUN
The RUN command is used to begin execution of the program that
is currently in memory.
ESAVE ESAVE
The ESAVE command is used to save the program that is currently
in RAM to the program storage EEPROM that resides in the system.
ELOAD ELOAD
The ELOAD command is used to transfer a program to RAM that had
previously been saved using the ESAVE command.
AUTOST AUTOST
The AUTOST command is used to set a flag that resides in the
program storage EEPROM that will allow the BASIC11 program to execute
from a powerup or reset condition. Note that the BASIC11 program is
executed out of the program storage EEPROM and is not copied into RAM.
This allows the entire system RAM to be used for variable storage.
NOAUTO NOAUTO
This command resets the auto start flag set by the AUTOST
command and disables the automatic execution of a BASIC program stored
in the program storage EEPROM.
4.0 Statements:
All of the following statements are used in the creation of
BASIC11 programs. The statements are arranged in logical groups to make
similar functions easy to find. Each statement is accompanied by one or
more program lines showing it's proper usage and an explanation of how
the statement works if necessary.
4.1 Assignment:
DATA <line number> DATA <number> [,<number>,<number>....]
10 DATA 500,-10,200,99,$CD03
20 DATA $FE , 1000, -300
The data statement is used to specify data that will be assigned
to variables with a READ statement. The data is read from left to right
and always begins with the first data statement in the program. When
the program has read all the data in a single DATA statement, BASIC11
will search the program for the next DATA statement starting at the
line following the just exhausted DATA line. This is done because all
data statements in a program are considered logically to be one long
DATA statement.
LET <line number> LET <variable>=<expression>
10 LET X=5
20 LET Y=25*(Y/3)
30 LET AX(3)=AX(5)*10
40 CD=DE+23
50 XZ=-55
The LET statement is the most often used way to assign a value
to a variable. Notice in line numbers 40 and 50 above do not contain the
keyword LET. This is what is known as an implied LET and is a feature
of BASIC11 to help cut down typing time when entering a program since
this is one of the most often used statements. One final note. As
stated earlier, Assignment statements and arithmetic/logic statements
may contain no imbeded spaces. This means that there may be no spaces
between the variable and equals, the equals and the start of the
expression, and no spaces within the expression.
READ <line number> READ <variable> [,<variable>,<variable>,....]
READ A,B,C
The READ statement is used in conjunction with the DATA
statement to assign values to variables. The first time the READ
statement is executed, it will assign the first item in the first DATA
statement to the first variable in its variable list. If additional
variables are present in its variable list, each one will sequentially
be assigned the next item in the DATA statement. Care must be taken
when a program is written so that BASIC11 does not try to read past the
last item in the last DATA statement. If this happens, Error # 38 will
be issued.
RESTORE <line number> RESTORE
330 RESTORE
The RESTORE statement is used to reset BASIC11's internal
"pointer to the next item" in a DATA statement to the first item in the
first DATA statement that appears in the program.
EEP() <line number> EEP(<expression>)=<expression>
25 EEP(30)=$55
30 EEP(X+1)=A/B
The EEP() statement is actually a special form of the implied
LET. EEP() is actually a subscripted variable that allows the BASIC
program to directly write to the MC68HC11's on board EEPROM. All the
timing and control information necessary to write to the EEPROM is taken
care of by BASIC11. This feature makes it very convenient to save any
kind of calibration data that must be retained in the event of a power
failure. Currently the subscript of the EEP() statement is limited to
255. CAUTION: Since the the number of write/erase cycles of the EEPROM
is limited, be very careful that the EEP() statement doesn't get
executed repeatedly for the same location by having it reside within a
loop.
PORTA
PORTB
PORTC
PORTD <line number> PORTx=<expression>
75 PORTA=$A5
85 PORTC=X+(E-K)
The PORTx statement is also a special form of the implied LET
statement. It allows BASIC11 to directly assign an 8-bit value to one
of the MC68HC11's I/O ports. Note that for a logic value to actually
appear on one of the port pins, that particular pin must have been
programed as an output by using the POKE() statement to write a one to
that particular port's Data Direction Register (DDR). If a value of
greater than 255 ($FF) is written to a port, Error #46 will be issued.
TIME <line number> TIME=<expression>
65 TIME=0
15 TIME=SC/60
The TIME statement, like the EEP() and PORT statement, is a
special form of the implied LET statement that allows the BASIC program
to assign a value to the system variable TIME which is used as BASIC11's
"Real Time Clock". BASIC11 uses the output compare one (OC1) register
to generate a periodic interrupt which is then divided down by software
so that the variable TIME is incremented once per second. Since the
variable is a 16 bit number, elapsed time can be kept track of for 65536
seconds (approximately 18 hours) without any software overhead.
PACC <line number> PACC=<expression>
85 PACC=25
95 PACC=-5.AND.$00FF
Like the TIME, EEP(), and PORT statements, PACC statement is a
special form of the implied LET statement that allows the programmer to
directly alter the value of the MC68HC11s Pulse Accumulator. Since the
Pulse Accumulator is only an eight bit register, the must be in the
range 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -