Adam D. Moss, adam@gimp.org / adam@foxbox.org
This is a decompressor for data packed with M.F.X.J. Oberhumer's UCL library (A.K.A. the magic behind UPX), specifically data compressed with UCL's "2B" algorithm.

This decompressor is written for the 8-bit Zilog Z80 CPU and compatibles, and uses just ~245 bytes of RAM for code and data.

So what?


More comprehensive usage instructions are in the ucl.asm file itself, but here is a quick example for you. This snippet takes packed image data and unpacks it to an address corresponding to the framebuffer on the Sinclair ZX Spectrum.
        INCLUDE "ucl.asm"
        BINCLUDE "hellokitty.data"
        ld      bc,     packed_data
        ld      de,     16384   ; destination (eg. frame buffer address)
        call    L2bunpack       ; unpack data at 'bc' address to 'de' address
out.sna is a .SNA file of this example poised before unpacking begins. (Actually it's a slightly less stripped-down version, but it does the same.)


This Z80 implementation of the unpacker is essentially public domain -- see the source file for details. I'd appreciate a mention if you use this (and drop me an email to say hi!).

Downloads and Links

The UCL/2B unpacker, Z80 assembly source code: ucl.asm v0.99-beta2

The UCL/2B packer executable, compiled for a Linux/x86/glibc system: simple.bin

The UCL/2B packer source, written in ANSI C: simple.c

Here's a link to M.F.X.J. Oberhumer's page of fun stuff, mostly his ongoing compression work. You can get to the latest UNIX/C versions of the UCL stuff from there.

In The Wild

Wow, someone has admitted to using UCLZ80 in a real production: You Are Adult by AY Riders. That makes me happy.


v0.99-beta2: 2000-10-25: First public release. I'm still calling it beta because it hasn't gotten much public 'airing', for now. I was actually sitting on it for a while hoping to use it for something world-shattering but haven't found the time yet, so here it is for all to share (especially those who still develop for the Sinclair ZX Spectrum and the TI-8x, you great guys and girls!)

To Do

I can't promise to work on these, but let me know which are a priority for you. Additionally, if you wish to contribute work towards the following then you would be welcome.


adam@gimp.org / adam@foxbox.org / Adam D. Moss
Last modified: Sat Oct 28 14:56:59 BST 2000