formats index
*** WRA (WRAptor compressed files)
** Document revision 1.1
Written by Bill Lucier (copyright 1995), and distributed by Loadstar (on
disk and from the website), this is an uncommon compression format as it is
a very recent program. It handles PRG, SEQ, USR and GEOS files, but not REL
files.
It utilizes a variant of the LZ (Lempel-Ziv) compression algorithm,
starting at 9 bits per code. The following is a dump of a sample WRA file.
Notice all the filenames are preceeded by the 4-byte signature "FF 42 4C
FF", which contains the authors initials "BL". (Note: much of the following
explanation is theoretical, as I have not been able to crack the
compression method yet.)
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ASCII
----------------------------------------------- ----------------
0000: FF 42 4C FF 50 4F 4F 59 41 4E 00 02 00 82 04 60 úBLúPOOYANú.ú‚.`
0010: 80 50 01 16 41 59 0C 14 F0 81 0C 47 49 31 11 40 €P..AY..ð.GI1.@
0020: 9E 4F 2C 90 49 C2 E2 61 3C 82 44 22 94 84 42 C1 žO,IÂâa<‚D"”„BÁ
0030: C0 B0 62 00 21 82 02 90 62 0C 61 63 19 43 D4 4D À°bú!‚.b.ac.CÔM
0040: 20 92 49 D1 F3 13 41 01 E0 02 78 68 37 1C 0D 40 ú’IÑó.A.à.xh7..@
0050: 14 E1 40 00 DD 0B FF 42 4C FF 50 4F 4F 59 41 4E .á@úÝ.úBLúPOOYAN
0060: 2E 4D 41 49 4E 00 02 7E 0C 0A B0 31 31 00 08 00 .MAINú.~..°11ú.ú
0070: 00 09 40 00 05 2A 00 02 A5 54 3C 81 10 88 00 08 úú@ú.*ú.¥T<.ˆú.
Byte: $00-03: FF 42 4C FF - File signature "úBLú"
04-xx: 50 4F 4F 59 41 4E 00 - File name "POOYAN", terminated with
a $00 (null) byte
02 - File type
01 = SEQ
02 = PRG
03 = USR
04 = GEOS
What follows the filetype is compressed file data, up until two bytes
before the next signature, or two bytes to the end of the file, whichever
comes first. The two bytes at the end comprise the 16-bit CRC value.
This format does not include information in the header that would
normally be considered important for the decompressor, such as:
1. No original or compressed file sizes
2. No offset to show where the next contained file starts
3. No version# info, to know if the decompressor you have is the correct
type to uncompress the file.
In order to get a simple listing of the files contained in an WRA
archive, you need to decompress each file in succession, a tedious task at
the best of times. This *is* the method WRAptor uses to display files in
its archives, and it is very slow!
From a cursory examination of the compressed data, the following possible
bit breakdown of a normal 9-bit code appears:
876543210
xyyyzzzzz
x - Code indicator
yyy - Command
zzzzz - Dictionary offset
If 'x' is clear, then the remaining 8 bits (yyyzzzzz) comprise a standard
byte of information. The byte is sent to the output file stream, and also
added to the decompressor dictionary. How the dictionary is built is still
a mystery.
If 'x' is set, then we have a "code", which needs to be decoded as
follows:
yyy - Command
000 - If 'zzzzz' is non-zero, do a "fill". Dictionary byte offset
of value to repeat is in 'zzzzz', repeat length in the next
5 bits 'aaaaa'.
if 'zzzzz' is zero, we have a special command. When a
'100000000' occurs (code value 256), something special
happens, but I don't know what yet.
001 - Dictionary reference. Offset in'zzzzz', length in the next 5
bits 'aaaaa'
010 - ???
011 - ???
100 - ???
101 - ???
110 - ???
111 - ???
Most "commands" have 10 bits following, the first 5 are the remainder
from the original 9-bit word, the other 5 must be read in separately. The
value of 'yyyyy' refers to a position in the decompressor dictionary. The
next 5 bits, "aaaaa" represent the "count" value, either how many times to
"fill" or how long of an entry we need from the dictionary.
As is the case in most LZ-variant compression programs, there should also
be several other "commands" defined:
- One to increase the dictionary length. This increases the "code" length
from 9 bits to 10 (or 10 to 11).
- One to "clear" the dictionary when it gets full, and start the code
length back over at 9 bits.
- One to indicate when the file ends, the "EOF". I suspect it is part of
the "256" code from above, but I can't be sure.
The LZW compressor, a specific implementation of LZ (of which I don't
think WRA is one) uses code 256 to show the "EOF", 257 to increase the
dictionary size and 258 to clear the dictionary. I suspect something
similar is at work in WRAptor as well, but decoding an unknown format takes
time.
ÿ