Poke Down and Abbreviated Save/Load

Author(s): Rolf Miller
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v4 n8 (Volume 4, Issue 8)
Date: August 1983
Pages: 18

With a 16K RAM pack, you can’t help but notice longer SAVE and LOAD times compared to a 1K or 2K machine. And when a program written with extra memory attached is published, it is often listed as 16K, regardless of its true length.

To avoid both problems, try this: Before starting a program, execute (without line numbers) POKE 16389,68 and NEW. No matter what your RAM, this process makes RAMTOP 17408, or 1K. (The other value used to determine RAMTOP at address 16388 is always 0 unless otherwise POKEd.)

With the computer now limited to 1K, begin writing. If your program fits and runs, it is a 1K routine. If 1K is not enough and you have more than 1K attached, SAVE what you have. Now POKE 16389,72 and execute NEW. Load your SAVEd program. Your computer now has 2K (with 16K you can unplug or POKE 16389,128 to restore 16K).

What if you already SAVEd your program using 16K? For sure it will not LOAD into less memory. So, LOAD it into 16K. Then execute CLEAR and PRINT PEEK 16396+PEEK 16397*256. If the number displayed is under 17408, the program fits into 1K; under 18431 fits in 2K.

Of course, just because it fits doesn’t mean it will run. IF you RUN it and PRINT PEEK 16412+PEEK 16413*256 still yields a number under 17408 for 1K or 18431 for 2K, it probably will run in that memory. The only way to know is to LOAD it into 1K or 2K and RUN.

This requires making a 1K or 2K SAVE from your present 16K version so you can LOAD it into lesser memory. With the 16K version LOADed, execute CLEAR and POKE 16389,68 for 1K or POKE 16389,72 for 2K. Then SAVE. You now have a 1K or 2K SAVE. Now execute NEW to set the computer to the limited memory, LOAD the just-saved routine into the smaller memory and RUN.

As you do this procedure, you surely notice the shorter SAVE and LOAD times. You can abbreviate a SAVE to include just the program portion of any length routine by executing CLEAR then POKE 16388, PEEK 16396 and POKE 16389, PEEK 16397 then SAVE. The resulting shorter SAVE loads into 16K just as quickly as it SAVEd. After the SAVE, unplug or POKE 16388,0 and POKE 16389,128 to restore 16K.