Chapter 5. Data Types
73
5.2.2 Classification of Variables
■ Work Variables
A work variable is intended for general use. You may use it either by declaring with the DIM
statement as a non-array variable or without declaration as an array variable. The following
examples show work variables:
DIM a(10),b%(5),c$(1)
d=100:e%=45
FOR count% = s1% TO s2%
NEXT count%
At the start of a user program, the Interpreter initializes all of the work variables to zero (0) or a
null character string. At the end of the program, all of these variables will be erased.
Upon execution of the
DIM statement declaring an array variable, the Interpreter allocates the
memory for the array variable. The declared array variable can be erased by the
ERASE state-
ment.
■
Common Variables
A common variable is declared by the COMMON statement. It is used to pass its value to the
chained-to programs.
■
Register Variables
A register variable is a unique non-volatile variable supported exclusively by BHT-BASIC. It
will retain its value (by battery backup) even after the program has terminated or the BHT has
been powered off. Therefore, it should be used to store settings of programs and other values
in the memory.
The Interpreter stores register variables in the register variables area of the memory which is
different from the work variables area.
Like other variables, register variables are classified into two types: string variables and
numeric variables, each of which is subclassified into non-array and array types.
The format of register variables is identical with that of general variables. However, you need to
declare register variables including non-array register variables with
DEFREG statements.
BHT-BASIC can handle array variables up to two-dimensional.
In the BHT-5000/BHT-6000/BHT-6500, when starting a user program stored in the flash ROM
for the first time, the Interpreter copies the register variables into the RAM (so that both the
flash ROM and RAM store the register variables). When modifying the register variables, the
Interpreter changes those stored in the RAM.
When uploading a program file stored in the flash ROM by using the
XFILE statement or Sys-
tem Mode, the BHT-5000/BHT-6000/BHT-6500 uploads the program (except for the register
variables in the flash ROM) together with the register variables stored in the RAM.
Comentarios a estos manuales