More seriously speaking: I think, something, where this could be exploited productively, is modifying a given display string by POKEs. Which may be of use for, say, writing a video game for a BASIC 10-liner contest.If we put the string definition at the very beginning of our program, it’s rather easy to come up with the POKE address.
10A$="12345678":REM <- INSERT SOMETHING MEANINGFUL HERE
On a C64, BASIC starts at $0801.
Add 2 bytes for the link to the next line in memory, and another two for the line number (stored always in two bytes as a binary value). Thus,
A$ starts at $0805. From here, we may count to $0809 (dec. 2057) as the address of the first character of the string (as stored in the BASIC text and referenced by the string variable
Now, at some point in the program, we could replace the “2” by another byte, e.g., “
POKE 2058,INT(RND(0)*5)+65” and print it again…
Or, the other way round, since this is the very first variable defined, it’s also easy to come up with the variable address in memory, just PEEK the value in pointer VARTAB. Now the 3rd byte contains the length and the next two bytes the storage address. By modifying one or both of them, we may readjust some padding on the left or right.
Suppose this represents a line of the screen for printing, but it’s more than 40 characters long. By setting the length to 40 and modifying the pointer, we may now scroll this line horizontally. If we increase the value in the pointer by one, we will lose padding on the left of the string and the line, possibly representing a character somewhere within, will also to the left.
(I may actually add this to the blog post. … Update: and I did so.)
Proof of concept, PET 2001, ROM 2.0 (“new ROM”):
Obviously, we could put lines 40-70 into a single line as a subroutine.