If
VARPTR(double-precision variable) returns
K:
(K)
= LSB of value
(K
+
1)
= Next MSB
(K
+
...
) = Next MSB
(K
+
6)
= MSB with hidden (implied) leading one. Most
significant bit
is
the sign of the number.
(K
+
7)
= exponent of value excess 128 (128 is added to the
exponent).
For single
and
double-precision values, the number is stored
in
normalized exponential form,
so
that a decimal is assumed before the
MSB. 128 is added
to
the exponent. Furthermore, the high bit of MSB
is used
as
a sign bit.
It
is set
to
0 if the number
is
positive or to 1 if
the number
is
negative. See examples below.
If VARPTR(string variable) returns
K:
(K)
= length of string
(K
+
1)
= LSB of string value starting address
(K
+
2)
= MSB of string value starting address
The address will probably
be
in
high
RAM
where string storage space
has been set aside. But, if your string variable
is
a constant (a string
literal), then it will point
to
the area of memory where the program line
with the constant
is
stored,
in
the program buffer area. Thus, program
statements like A$
= "HELLO" do not use string storage space.
For all of the above variables, addresses (K-1) and (K-2) stores the
TRS-80 Character Code for the variable name. Address (K-3)
contains a descriptor code that tells the computer what the variable
type
is.
Integer
is
02; single precision is 04; double precision is 08;
and string is
03.
VARPTR(array variable) returns the address for the first byte of that
element
in
the array. The element consists of 2 bytes if it is
an
integer
array; 3 bytes if it is a string array; 4 bytes if it is a single precision
array; and 8 bytes if it is a double precision array.
The first element
in
the array is preceded by:
1.
A sequence of two bytes per dimension, each two-byte pair
indicating the "depth" of each respective dimension.
2.
A single byte indicating the total number of dimensions
in
the
array.
3.
A two-byte pair indicating the total number of elements
in
the
array.
4.
A two-byte pair containing the ASCII-coded array name.
2-175