Commodore PET User Manual page 333

Table of Contents

Advertisement

Byte:
3
4
Number
32767
127
255 (256-127+255
=
32767)
32766
127
254
14000
54
176
256
1
0
255
0
255
1
0
1
-1
255
255 (FFFF16)+ 1
=
1
-2
255
254
-32766
128
2
-32767
1281
1
String Variable Format
Byte:
2
3
4
5
6
7
1st
2nd
Char
char
char
+128
count
High
or 128
Byte 1 contains the first character of the variable name. Byte 2 con-
tains the second character of the variable name shifted'(+128), or if there is
no second character, the second byte contains 128. This combination of ASCII
ranges denotes a string variable entry. The $ notation is dropped from the variable
name. Byte 3 contains a count of the number of characters in the string (1 to
255). This is the value fetched for the LEN function. Bytes 4 and 5 contain a
pointer to the beginning of the string itself, stored elsewhere in memory.
This pointer is in the standard 6502's low-byte, high-byte order. The remain-
ing two bytes are not used and are set to zeros.
String shortage is optimized by using the copy of the string already in
memory if there is one. If there is not, a string is created and stored in the
String Area in upper core. A few examples are given below.
Constants
Constants are stored in the BASIC statement itself. They are not placed into
a separate area of memory. and they are not stored in the Variable Area. Floating
point and integer and string constants are stored as ASCII character source
codes, as described previously under BASIC Statement Storage. For example. the
line:
10 PRINT "HI!"
is stored entirely in the BASIC Statement Area, in the form:
320

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cbm

Table of Contents