The following is Dick’s version of an article that appeared in SYNTAX 8/83 by Rolf Miller, Ventura CA.
When using the 16K or larger RAM packs, program LOADs and SAVEs use the full extent of available memory. The following routine will allow only the memory used by the program and variable area to be SAVEd to tape.
After LOADing the program into memory, type CLEAR, ENTER, PEEK 16396 – 256 * PEEK 16397, ENTER to get the amount of memory used by the program. If LOADing or typing a program with a large amount of variables to be SAVEd -omit the CLEAR !
As an example: the following is inserted in all programs I am now entering into my computer:
9990 CLEAR (if arrays have been DIM or other variables were ENTERed in the immediate mode OMIT)
9991 POKE 16388, PEEK 16396
9992 POKE 16389, PEEK 16397
9993 SAVE "program name"
9999 GOTO 1 if you ommitted 9990
9999 RUN if you used 9990
I’ve used this routine on several programs in the last month. It really comes in handy when entering a 2K or less program with RAM pack on the back. While the program saves in 2K or less, this does not mean it will run if transferred to a 2K system. To see if it will run, try the following:
ENTER or LOAD the program
RUN or GOTO 1
BREAK and PRINT PEEK 16412 + 256 * PEEK 16413
If the resulting number is less than 18431 then that program will mostly run in 2K or less.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.