PACK, a program packer, by Joseph K. Horn. [Note: This PACK is a stand-alone program. A shorter version of PACK which calls other routines is in the IO file on this disk. -jkh-] Purpose: Shrinks and speeds up programs that contain SYSEVALs. Has no effect on programs that do not contain SYSEVALs. Instructions: Recall program object to the stack. Run PACK. Store the new program object into a new name or into its old variable name if so desired. The newly PACKed program will be shorter and run faster than the old one. Theory: The SYSEVAL instruction takes a binary integer as its argument. But a binary integer followed by SYSEVAL takes up 31 nibbles, and can be replaced by just the leading five nibbles of the binary integer. Such replacement not only uses less memory, but runs faster. Unfortunately, these objects do not have names, and show up in listings as "External", rendering the program unreadable and uneditable. But it runs just fine. Note well: PACK was intended for use on programs, but performs the same packing on lists. If a list contains a binary integer immediately followed by a SYSEVAL, both will be replaced by the equivalent External object. PACK should only be used on the final version of a program, because once a program contains External objects, it is not editable by normal methods. A good practice might be to keep an "original version" with SYSEVALs, and a "working copy" PACKed and ready to use, in two separate variables. EXAMPLE 1: You wish to make a key assignment that puts you into the hidden directory. Let's put it on the POLAR key. Normally you'd do this: { << HOME #15781h SYSEVAL 2 MENU >> 82.3 } and then press STOK (in the blue-CST menu). That would work. But before you press STOK, run PACK; the list becomes { << HOME External 2 MENU >> 82.3 } because the address #15781h and the SYSEVAL got replaced by the equivalent External object. Now press STOK, and the assignment will be 26 nibbles shorter and a little bit faster. (If you actually did this example, you may delete this key assignment, if you wish, by typing 82.3 and pressing DELK.) EXAMPLE 2: You have a program that looks like this: << #18CD7 SYSEVAL #21922 SYSEVAL #3DEF SYSEVAL #62F89 SYSEVAL >> It takes a port number (0, 1 or 2) and recalls that port's objects onto the stack. It is 72 bytes long (checksum: #CBDAh). PACK it, and it shrinks to only 20 bytes long, but is no longer readable or editable. Thanks to Rick Grevelle & Derek Nickel for the tools used here.