Speccy, Vol 4: Compressed Loading Images

December 29th, 2015

I've spent some time working on something nobody probably cares about, but which I find fun and cool.

As I mentioned before, loading apps.. well, let's be honest: games on the spectrum took some serious time. As we recall, a 32KB game takes about 32 * 1024 * 8 / 1200 = ~220 seconds to load. People quickly learned to add loading screens to their games, wherein the game first loads a small basic program, which then loads raw data directly to video memory, and then continues to load the game itself, and finally executes.

Now, the loading directly to video memory means we're loading 32*192 bytes of bitmap followed by 32*24 bytes of attributes (6912 bytes total) at 1200bps, which takes about 46 seconds, not including the delays between different blocks. So in addition to your 220 seconds of game loading you wait 46 seconds to load a screen.

The picture additionally loads directly to video memory, so you first see a more or less broken bitmap slowly fill the screen and then when the color attributes come in you finally see the actual picture. Good side is that at least something is happening, but it's still quite bit of a waste of time.

So, I made a compressed loading screen loader maker tool.

With the loader, the user loads a basic program that has the decompressor and image data appended in it, executes the decompressor that dumps the image to screen very quickly, then continues loading the game itself and executes it. In addition to reducing the amount of data loaded, we also skip at least one file header. With my test image (compression varies with data naturally) the data loaded is only about 1600 bytes, or about 11 seconds, which is much more tolerable.

Except, of course, on emulators, which speed load the tapes and you probably won't see the loading images anyway.

As before, all of the code is available on github.