Saving the text screen into strings???
Allen Huffman via Coco <[email protected]> Thu, 30 Apr 2026 22:13:27 -0500
| Newsgroups | gmane.comp.hardware.tandy.coco |
|---|---|
| Message-ID | <[email protected]> |
In the TRS-80 MC-10 Facebook group, Jim Gerrie posted some code he was trying to convert to the MC-10. It came from (I think) a TRS-80 (Model I or III or whatever?). What it did was make a temporary string, like A$=“” Then us VARPTR to get the address in memory where the 5-byte string descriptor lives. Only 3 of those 5 bytes are used for strings: 0 = length of string 2 = MSB of string data 3 = LSB of string data Normally the MSB/LSB point either to a spot in the reserved string memory (“CLEAR 200” for 200 bytes of string memory, etc.) OR they point inside the program itself if it is a string declared int he program: 10 A$=“THIS IS IN PROGRAM SPACE” The program then changes the MSB/LSB for the temporary string to point to the top of screen text memory (1024 on the CoCo), and changed the length to the max of 255 bytes. Now that string — if you PRINTed it, would echo whatever was the first 255 characters of the screen. But that changes as you print, so not useful. Then it copies that string into a second string, that lives in normal string memory. You now have a normal string that is a copy of what the first 255 bytes of the screen where! Use two strings this way and you can save 510 of the 512 byte screen, then restore them at any type just by doing something like: PRINT@0,S1$,S2$; Jim got the code working for the MC-10, and I got it working for the CoCo. I’ll have an explainer blog post with more details tomorrow on www.subethasoftware.com <http://www.subethasoftware.com/> But I wanted to ask here: Have any of you ever done this? Or seen it done? It’s interesting. -- Allen Huffman - PO Box 7634 - Urbandale IA 50323 - 515-999-0227 (vmail/TXT only) http://www.subethasoftware.com - https://www.facebook.com/subethasoftware -- Coco mailing list [email protected] http://listserv.adelphi.edu/cgi-bin/mailman/listinfo/coco