On Sun, Jan 18, 2026, 3:35 PM B9 <[email protected]> wrote: > Oh ho! Now that's an interesting trick. Can one safely change the LENGTH > byte of "ordinary $tring animals"? >
I am not sure that would be safe. > > > For instance, if one made a string holding two copies of 40 characters and > changed the length from 80 to 40, then incrementing the address pointer > would cause it to appear to rotate. > Maybe. That has more to with the pointer than the length though. I was thinking more of accessing portions of the lcd buffer. Like you set the pointer once and then efficiently access slices of it with string operations. > Or would such a string eventually get mangled when some other string's > operation required garbage collection? How does BASIC know not to move the > extraordinary $trings? > It doesn't. It can move them if you trigger the garbage collector. But if you're careful you can avoid that or force it to happen when you want to. And then you need to re init the pointer. > If it doesn't touch literal strings in the BASIC program, maybe that's the > right place to put strings I want to play tricks with. Self-modifying code > is easy to mess up, but I've already got a well-tested routine in the > M100LE game that calculates the RAM address of a file for all Model-T > variants. > Yeah literal strings are somewhat safe from moving. Also the ROM if you have some use for those byte. It depends on what is in the strings. When I embed ml in strings I recall being careful not to put NUL and maybe backspace. > A BASIC program can never change location in memory while it is running, > right? > Nope. -- John. >
