Variables - Sharp mz-800 Owner's Manual

Hide thumbs Also See for mz-800:
Table of Contents

Advertisement

5.4
Variables
Variables are locations in memory which are used to hold values during program execution. You must
give a specific name to each variable when writing a program. Values held by these variables may be
arbitrarily changed during program execution.
There are three types of variables handled by MZ-800 BASIC: numeric variables, string variables and
system variables.
(1) Numeric variables
Numeric variables can hold only numeric data. The name of each variable may be composed of any
number of characters, but only the first two characters actually identify the variable. For example,
AB and XYZ are different variables, but ABC and ABD are handled as the same variable.
Lowercase letters cannot be used for variable names.
The first character must be a letter from A to Z, but the second and the following characters may
be any letter of the alphabet or numbers; however, special characters such as @ and * cannot be used.
No reserved words (see Appendix C.) may be used as the names of a variable. For example, PRINT
and C@ cannot be used as the names of variables.
Each numeric variable contains 0 until some value is given.
(2) String variables
A string variable can hold only string data, and its name can be assigned in the same manner and with
the same limitations as the name of a numeric variable. The only difference is that it is always followed
by a dollar sign ($).
Each string variable may contain a maximum of 255 characters of string data. Each string variable
includes only null characters until some stirng data is given.
(3) System variables
There are special variables called system variables, which are defined and used by the BASIC inter-
preter. The following table lists the system variables.
System variable
Explanation
TI$
Contains a 6-digit number which is the time from a 24-hour built-in clock.
For example, the value '*192035"" indicates that the clock reads 19:20:35.
The clock is always set to 00:00:00 when the power is turned on.
SIZE
Indicates the amount of free memory area which can be used for BASIC programs and
data.
ERN
When an error occurs, this variable contains the corresponding error number.
ERL
a
When an error occurs, this variable contains the line number of the error.
CSRH
Contains the column position at which the cursor is located.
0=CSRH 339 (40 column screen mode)
0sCSRH $79 (80 column screen mode)
CSRV
Contains the line number at which the cursor is located.
0sCSRV524
POSH
Contains the X-coordinate of the graphics position pointer.
— 16384 < POSH = 16383
POSV
Contains the Y-coordinate of the graphics position pointer.
— 16384
<= POSV s 16383
5-5

Advertisement

Table of Contents
loading

Table of Contents