65-66

From C64-Wiki
Jump to navigationJump to search

The zeropage addresses 65–66 ($41–$42 in hexadecimal) hold a pointer (in the standard low-byte/high-byte format) to the address in BASIC program memory from where the next DATA item is to be READ.

Example[edit | edit source]

The following example reads a series of words from DATA statements, until the word "quit" is encountered, listing each word with the address in BASIC program memory where that word is stored:

10 read i$
20 print i$;" is stored at";
30 print peek(65)+256*peek(66)
40 if i$<>"quit" then goto 10
50 data this,example,comes
60 data from,the,c64-Wiki
70 data quit
run
this is stored at 2140
example is stored at 2148
comes is stored at 2154
from is stored at 2165
the is stored at 2169
c64-wiki is stored at 2178
quit is stored at 2189
ready.

Note that the addresses refer to the point in the BASIC program text where the words are stored as part of the DATA statements, not to the i$ variable in which the words are temporarily stored.

Also see 63-64.