To convert the
two
values to the appropriate address. you can convert them
separately
to
hexadecimal and then convert the hexadecimal address
to
decimal:
Low
High Address
5810=3A16
310=
03
16
033A16=82610
Note carefully
that
the sample value
033A
means
that
the first memory byte
=
3A
and the second (higher! memory byte = 03.
Or you can
multiply
the high-order byte by 256 and add it
to
the low-order
byte. The
following
is
a
PEEK
statement
that
will
do this for you:
?PEEK
(1)
+256*PEEK
(2)
826
Conversely,
to
convert a
16-bit
memory address
into
two
separate bytes for
POKEing (in low-byte, high-byte order!, you can convert the decimal value
to
hex-
adecimal and then convert the separated byte
digit
pairs to decimal. e.g
..
to
con-
vert the address 59409:
594091O=
E811
16
High
E816=2321O
and
Low
Or you can convert using decimal arithmetic by first dividing the address value by
256 and discarding any fractional remainder:
High
59409/256=232.06641
=232
Then subtract
"High"*256
from the original value (59409 in this case) to get the
remainder.
which
is
the low-order byte value:
232*256
=59392
Low
59409 -
59392=
17
(Of course, if you do the division by longhand. the remainder
is
directly available.)
For a block of byte locations. only the first byte value
is
shown in the table.
The column labeled Description in the table gives a short description of the
location'suse. There are mu Itiple uses for some locations, in
which
case the prim-
ary one
is
indicated.
While
not exhaustive, the table illustrates the overall makeup of the
PET
memory.
309