Compress Commodore programs with Exomizer

Exomizer is a compression program for Commodore and other 8-bit computers. The compressed program still runs, but it takes up less space on disk. Decompressing takes some time, but usually less time than reading more data off a 1541 disk. And unlike native compression tools which sometimes take all night to run, Exomizer runs on modern PCs, so it runs extremely quickly.

The space savings isn’t as much of a consideration now as it was in 1986, but being able to cram as many programs as possible on a single disk image makes access more convenient.

Packing down machine language programs

So I tested it on Crossroads II by Steve Harter. Published in the December 1988 issue of Compute!’s Gazette, it was probably the best type-in ever done for the 64. It was also one of the longest, and was written in machine language. I extracted it from the D64 image using D64 Editor, then ran the command exomizer sfx sys “crossroads ii.prg” -o crossroads2.prg. It knocked 1,370 bytes off the 6,590-byte original. I then wrote the compressed program back to the D64 image.

Keep in mind this program was considered huge in 1988. Typing it in required you to type 6,590 hexadecimal numbers perfectly.

I typed in the original Crossroads from the December 1987 issue, but when Crossroads II came out, I bought the disk. If you’ve ever wondered why I’m such an admirer of tightly written code, it’s because of the hours I spent typing in programs from magazines in the 1980s.

Packing down Basic programs

Exomizer also includes Exobasic, a utility for mashing down BASIC programs. It doesn’t seem to do the old trick of combining lines (each line has an overhead of about 10 bytes, if memory serves), but it has a goofy renumbering trick. Any lines that don’t get referenced by a GOTO or GOSUB statement get set to line 0. The program still runs, and all the branches work correctly, but since the referenced line numbers are shorter, they take up less space and the program runs faster.

So I did some tests using MOB Mover from the October 1991 issue of Gazette, a graphics utility program I’m familiar with considering I helped write it. (I can’t believe it’s been 20 years.) Exobasic knocked 75 bytes off that program, but when we wrote it, we used quite a few memory saving tricks. We tried to strike a balance between making the program easier to type in, making it run quickly, and making it easy for end users to modify.

At any rate, shaving off 75 bytes was enough to save a disk block.

Combining utilities for maximum compression

It’s clever. If you want the smallest-possible BASIC program, you’ll have to run Crunch from the August 1985 issue of Compute!’s Gazette on it from within a C-64 emulator (which shaves 295 bytes off MOB Mover). To run Crunch, you load it, then you load the program you want to crunch and type SYS 49152. Crunch then tells you how much it saved. Save the file to disk. Then you can go back to your host machine, and extract the crunched file, and run Exobasic on it to renumber the program optimally. The resulting code is a mess to look at. But runs faster than before since there are fewer gaps in memory for the BASIC interpreter to plow through.

Crunch makes Exobasic work better. The crunched version of MOB Mover compressed 98 bytes.

Then, to make the program as small as possible on disk, you can run Exomizer itself on it. Use a command like exomizer sfx basic infile -o outfile.

The combination of Crunch, Exobasic, and Exomizer shaved MOB Mover down to 2,447 bytes from its original 5,371 bytes.

I wish Exobasic would do what Crunch does. And for the record, RUN published a similar utility called Line Squeezer, written in BASIC, in its November 1984 issue. But the things it does do are clever indeed. And a combination of utilities can really pack down Commodore programs.

%d bloggers like this:
WordPress Appliance - Powered by TurnKey Linux