TRS-80
MODEL III
For all of the
above variables,
addresses (K
-
1
)
and (K
-
2)
will store the TRS-80
Character Code
for the variable
name. Address
(K
-
3)
will contain 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.
VARPTRf
array
variable)
will return the address
for the first byte
of that
element in
the array. The
element will consist
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
.
5.
A one-byte type-descriptor
(02
=
Integer, 03
=
String, 04
=
Single-Precision,
08
=
Double-Precision).
Item
(
1
) immediately precedes the first element. Item
(2)
precedes Item
(
1
)
,
and so on.
The elements of the array are stored sequentially
with the first dimension-subscripts
varying
'
' fastest'
'
,
then
the
second
, etc
.
Examples:
A!
=
2 will be stored as follows
2=10
Binary, represented as . 1E2
=
.
1 x 2
2
So exponent of A is 128 + 2
=
130
(called excess 128)
MSB of A is 10000000;
however, the high bit is changed to zero since the value is
positive
(called
hidden or
implied leading one)
.
So
A!
is stored
as
Exponent (K +
3)
MSB (K +
2)
Next
MSB (K +
1)
LSB (K)
130
A!
=
—
.5 will
be
stored
as
Exponent (K +
3)
MSB (K +
2)
Next
MSB (K
+
1)
LSB (K)
128 128
A !
=
7
will
be stored as
Exponent (K
+
3)
MSB (K +
2)
Next
MSB
(K +
1
)
LSB (K)
131
96
A!=-7:
Exponent (K +
3)
MSB(K +
2)
Next MSB (K+l) LSB (K)
131 224
Zero is simply stored as
a
zero-exponent. The
other bytes are insignificant.
194