EasyManua.ls Logo

Commodore CBM - BASIC Statement Storage

Commodore CBM
447 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
BASIC
STATEMENT
STORAGE
BASIC statements are stored
in
the format shown
in
Figure
6-3.
Memory
location
1024
always
contains a zero byte.
The
next
two
bytes contain a pointer to the beginning of the first BASIC
statement.
The pointer. like ail addresses in the
PET.
is
stored in low-byte. high-
byte order. The pointer
is
a link
to
the memory address of the next link. A link ad-
dress of zero denotes the end of the
text;
i.e
..
there are no more links and no
more statements. BASIC statements are stored in order of ascending line num-
bers. even
though
there are links to the
next
statement. Links are used
to
quickly
search through line numbers.
Following the link address
is
the line number of the statement, stored in
low-byte,
high-byte order. Line numbers go from 1 (stored
as
1 and 0)
to
63999
(stored
as
255 and 249).
After
the line number, the BASIC
statement
text
begins. Keywords are
comprised of reserved words
(listed
in
Table
3-2)
and opera
tors
(listed in Ta-
ble
3-4).
Reserved
word
and logical operator keywords are stored in a com-
pressed format. A one-byte token
is
used
to
represent a keyword.
Ail
keywords
are encoded
su
ch
that
the high-order
bit
is
set to
1.
Other elements of the BASIC
text
are represented by their stored ASCII code. Other elements are comprised of
constants. variable and array names. and special symbols other than operators
and are coded
just
as
they appear in the original BASIC statement. Table
6-3
shows the
byte
codes for ail values from 0 to
255
that
may appear
in
the
compressed BASIC
text.
Codes are interpreted according to this table
ex-
cept
after
an
odd
number of double quotation marks enclosing a character
string;
within
a character string the standard ASCII codes prevail (see Ap-
pendix A).
312
102410251026102710281029
ŒJ
GQ
1
Lin:e*
Il
.....
c.;.o-m-p-re-s-se-d-B-A-S-IC-te-x-t
""'1
ŒJ
$ l
"+'11
Corn,,,,,,,
BASIC
''''
1
ITJ
.
.
~
1
Lin:e*
Il
Compressed BASIC
text
1m
~
End
of
text
is
indicated by
~
two
link bytes of zero
Figure 6-3. BASIC Statement Storage
end
of
statement
is
flagged
by
zero
byte

Table of Contents

Other manuals for Commodore CBM

Related product manuals