Tandy 1000 Basic Reference Manual page 359

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter
11 I
Technical Information
How Variables are Stored
BASIC stores variables in its data segment as follows:
Byte
Byte 0
Bytes 1 and 2
Byte 3
Byte
4
+
integer stored
in Byte 3
Byte
4
+
length
Contents
Description
Type
Identifies the type of vari-
able stored
at
this location:
2 integer
3 string
4
single precision
8 double precision
Name
The first 2 characters of the
variable name.
Integer
Integer is the number of ad-
3
-
38
ditional characters in the
variable name.
Name
The remainder of the vari-
able name is stored at bytes
4
+
the integer stored in
Byte 3.
The contents of the variable
are stored in the bytes im-
mediately following the vari-
able name. The data can be
2, 3,
4,
or 8 bytes in length,
depending on the type of
data.
Data
At least 3 bytes are required to store any variable name. A
1- or
2-character variable name occupies exactly 3 bytes. Bytes 1 and
2 for the first 2 characters and Byte 3 to contain a zero to indi-
cate that there are no additional characters in the variable
name. If the variable name only contains 1 or 2 characters, the
data is stored beginning a t Byte
4.
As you can see, the location
of the first actual byte of data depends on the length of the vari-
able name. VARPTR returns the offset of the first actual byte of
data, not the offset of the beginning of the storage area.
357

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents