VARPTR (variable name)
Returns an address-value which will help you locate where the variable name and
its value are stored in memory.
If
the variable you specify has not been assigned a
value, an
Fe
errorwill
occur
when
this function is called.
IfVARPTR(integervariable) returns address
K:
Address K contains the least significantbyte
(LSB)
of2-byte
integer.
Address
K+ 1contains the most significant byte
(MSB)
of
integer.
You can display these bytes
(two's
complementdecimal representation) by
executing a
PRINT
PEEK
(K)
and a
PRINT
PEEK
(K
+1).
IfVARPTR(single precision variable) returns address K:
(K)* =
LSB
of
value
(K
+
1)
= Next
most
significantbyte (Next
MSB)
(K
+2) =
MSB
withhidden (implied) leading one. Most significant
bitis the sign
of
the number
(K
+3) = exponent
of
value excess 128 (128 is added to the exponent).
If
v
ARPTR(
double precision variable) returns
K:
(K)
=
LSB
of
value
(K
+
1)
= NextMSB
(K
+
...
)= NextMSB
(K
+6) =
MSB
withhidden (implied) leading one. Most significant
bitis 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 numberis 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
numberis positive
or
to 1
if
the
number
is negative. See examples below.
You can display these bytes by executing the appropriate
PRINT
PEEK(
x)
wherex
the address you
want
displayed. Remember, the result will be the decimal
representation
of
byte, with bit 7
(MSB)
used as a sign bit.
The
numberwill be in
normalizedexponential form with the decimal assumed before the
MSB.
128 is
added to the exponent,
IfVARPTR(string variable) returns
K:
K = length
of
string
(K
+
1)
=
LSB
of
string value starting address
(K
+2) =
MSB
of
string value starting address
*(K) signifies
"contents
ofaddress
K"
The
address will probably be
in
high
RAM
where s,tring storage space has been set
aside. But,
if
your
string variable is a constant (a string literal), thenit will point to
the area
of
memory
where the program line with the constant is stored, in the
programbuffer area.
Thus,
programstatements like
A$
"HELLO" do not use string
storage space.
8/9