|
Inferno #05
30 апреля 2004 |
|
Softinka - Hrum 3.5i - the fastest LZ-extractor with the bit stream.

Hrum 3.5i
For unpacker Hrum author stated
particularly high rate: 33 k / sec. Unfortunately, I have no
information, what types of data had in mind, but in general,
and Overall the author is right - it is the fastest
LZraspakovschik with the bit stream. Due to the simplified in
connection with this format, it also and extremely short.
Unfortunately, the author's package does not offer unpacker
without throwing for him for several blocks.
Throwing - a functional feature
Hrum obvious predecessors in the field
compression 48k igrushek.Ideologiya this process is as follows:
code block MUST be immediately after the unpacker, unpacker
startup throws its active part of a quiet place (as a rule, #
5bxx), and packed block - at the end of the memory allocated
for decompression, all addresses for this calculated in advance
(packer) and lie in the body unpacker.
In Hrum introduced three original uhischre of:
1. 5 bytes of the end of the file (this is an important part
of file is created for the gap between the addresses, "where"
and "to unpack") are copied along with the unpacker in the
"quiet place, "one team LDIR.
2. Suggested even shorter way
implementing the standard tree of the 16 variants, with whom we
shall meet again:
LD E, 1
pair LD A, # 80
pair0 <getbit>
RLA
JR C, pair0; 2 passes
CP 3; A = 0 .. 3
JR C, treeend
ADD A, E
LD E, A
XOR C; = # 10!
JR NZ, pair
treeend ADD A, E
The trick in the team XOR C. Ie will be shorter than in
PCD6.2 (there was a SUB 15) and even more so than in MS Pack
(there was no cycle and had an extra XOR A). Konstanta C = # 10
used elsewhere: in the treated TKE bitstream.
3. The same cycle of taking the 3.4-bit
(Closer to the end of the unpacker) is used for taking dispH
(at putsЄ4), so and for taking dispL (for puts = 1), and for
the work of this cycle never spoils
flag Z! This flag and is an indication that
to do with the result ...
Dictionary (the window) just 4k.
There are two alternate data stream:
bit and byte. Bit stream is stored
chunks of 16 bits and is withdrawn in the register pair HL.
While HL shifts, 16-bit counted in the register B team DJNZ.
When they come to an end, the flow is taken from the new value
of HL.
Packed with unpacker unit contains:
Initialization unpacker.
Active part of the unpacker.
5 bytes of the end of the file.
2 bytes of the start of the bitstream.
1 byte - the first byte of the file.
And further, according to the bit stream:
% 1 - put a byte from the byte stream.
% 000,-disp3 - copy 1 byte at address
minus 1 .. 8.
% 001 - copy 2 bytes:-disp8 taken
from a byte stream.
% 010 - copy 3 bytes is similar.
% 01,100 - to copy N bytes (N is taken from
bitstream, N = 0 - end of file). Here
and then after determining the length of produ
didsya divination by bit from the bit stream:
% 0 --dispL taken from the byte stream;
% 1 - is similar, but not before-dispH in
number of 4 bits taken from the bit of
current. Notice the redundancy of the formula
mat:-dispH = # FF is encoded in two ways, by
saved 1 byte unpacker. Unintelligible
Humor is also the author of the team RES 5, A, to Thoraya
might look like LD A, # 1f. % 01101 - copy 4 bytes as above.
% 01110 - copy 5.
% 0111100 - copy 6.
% 0111101 - copy 7.
% 0111110 - Copy 8.
% 011111100 - © 9.
011111101% - copy 10.
011111110% - copy 11.
01111111100% - copy 12.
01111111101% - copy 13.
01111111110% - copy 14.
01111111111% - copy 15.
Hrust 1.x
Unpacker Hrust 1.x - the most cunning
unpacker for ZX. Despite the small
size, it is quite able to confuse anyone
Visitor.
Unique format in that it directly
designed to compress kodov.Dlya he
equipped with a code to copy from the rupture, which are not
present. Additionally applied to the expanding codes
displacements, which beginning of the file are short and
indicate the close, and closer to the end - long.
In the author's kit has two unpacker - with the input of the
stack and input stream to IX. Another unpacker
in the form of BASIC-loader made in the first
Alone Coder. They are all equivalent.
Unpacking begins with transfer
packed block at the end of the memory allocated for
decompression. The transfer is only if the address of the end
of the packed block initially less the end of the memory
address to decompress. BASIC version of the fragment does not
contain, there is need to control yourself, to pack the blocks
during decompression portilsya.Tem not, however, there is a
chance that he zaporetsya and copyright unpacker, after the
transfer. For this end of the block must be bad packing.
Bit stream is taken chunks of 16
bits. C contains the constant 16. D contains
thrown a bit, whose position relative to left edge of the byte
determines the length of expandable options. Initially, D = # bf
(We call this state "2-bit expandable
links "), followed by sporadic RRC
D ("3 .. 8-bit expandable links").
Packed blocks have a title:
+0 "HR".
2 unpacked length.
4 packed length.
6 the last six bytes of the block.
12 two bytes of the beginning of the bitstream.
13 the first byte of the block.
14 themselves packed data.
Packed data processing is carried out according to the
instructions of the bitstream:
% 1 - get a byte from the byte stream and
place to unpack.
% 000,-disp3 - copy 1 byte with shift of -1 .. 8
% 001 - copy C = 2 bytes. disp encoded
tsya as follows:
00Ў%% 01:-dispH = # fdЎ # fe,-dispL in the bit
flow;
% 10:-dispH = # ff, on the basis of the byte
flux: number <# e0 understood as
-DispL (reference plain), Є # e0 slyly:
RLCA: XOR C, with A =- 1 extends the length of
links, or SUB 15 and get-dispL =
B2Ў = # # ee (link with plug-bytes: bytes
of $-disp, bytes from a byte stream of bytes
from $ +2- disp);
% 11,-disp5: common link (through the% 10 is the
Kie short disp is impossible to describe);
% 010 - copy C = 3 bytes. Here and below
disp coded as follows:
% 00:-dispH = # fe,-dispL in the bit stream;
% 01:-dispH = # ff, on the basis of the byte
flux: number <# e0 understood as
-DispL (reference plain), Є # e0 slyly:
RLCA: XOR C, with A =- 1 extends the length of
links (actually not used)
otherwise, SUB 15 and get-dispL = # b1Ў # ef
(With plug-byte: byte from $-disp, bytes
from a byte stream of bytes from $ +2- disp);
% 10,-disp5;
% 11: widening reference. -DispH taken
from the bitstream, the number of bits according to
D (# bf .. # fe corresponds to 2 .. 8 bits).
-DispL taken from the byte stream. In
The other links as a reference.
% 01100 - copy C = 4 bytes as above.
Here and further codes of links with plug-ba ytom
unprofitable, but there is. % 01110 - copy 5.
% 0111100 - copy 6.
% 0111101 - copy 7.
% 0111110 - Copy 8.
% 011111100 - © 9.
011111101% - copy 10.
011111110% - copy 11.
01111111100% - copy 12.
01111111101% - copy 13.
01111111110% - copy 14.
01111111111% - copy 15.
And special cases:
01101000001111% - end of file.
% 0110100, len7 - if len7> 15, len will be
equal len7 * 256 + bayt_iz_baytovogo_potoka.
In any case, the result will lie in BC, and
see further cases with len = 3 .. 15.
% 0110101xxxx - 12Ў42 (even number) of bytes
from a byte stream.
% 011011,-disp4: link with plug-byte:
bytes from the $-disp, bytes from a byte stream
bytes from $ +2- disp. Made from the fact that
at 001% provided only-dispL = # b2 ..
# Ee, and even, but in only 010% # b1 ..
# Ef, odd.
Hrust 2.x
Format designed to compress tekstov.Nesmotrya that the
author packer was inconvenient, and the format (1998) with the
advent of RIP (2000) and ZXRar (2003) is outdated, he
also became the only truly STANDARD compressed data format for
ZX. AND not only for the texts.
Some packers Hrust 2.x is now known to nine (!), They all
grew out of code original wrapper. Number of same
programs supporting the format to unpack the UWC, I was not
identified.
Ideology adopted the opposite Hrum:
unloading of packed blocks only without unpacker, unpacker
individual does not use the stack. Perhaps due to a combination
these ideas, the format has won the rest?
In practice, there are two versions of the titles packaged
units: v2.1 and v2.3. Standard is used pervaya.Vtoraya only in
the archives Hrip.
v2.1:
shift length
0 3 "hr2";
3 1 "1". If bit7 = 1, then the file
was just "saved";
(And hence - w [+4] = w [+6])
4 2 length of the source file;
6 2 length of the packed file;
+8 W [+6] compressed file.
Before the packed unit stores the last 6 bytes of the file
yourself these 6 bytes are not packed.
The maximum length of a repeating fragment encoded by a
single reference: 4095 bytes (# Fff). Maximum back reference:
-65535 bytes (in the author box packer: 16384
bytes, in other well-known packers reaches 32768, but decreases
when approaching the packed piece of nepakovannomu - Packaging
is in the same buffer)
011000nnnn - several nepakovannyh bytes
or rather, 12 + nnnn * 2 (no more than 42, as the bottom of
the form), in a byte stream - these bytes. 1 - just one
nepakovanny bytes (in Hilbert buy flow - this byte). 000xxx - a
repetition (xxx = disp3). 001 - 2 repeat (in the byte stream
disp8). 010 ... - 3 replicates.
01101 ... - 4 repeat.
01110 ... - 5 repetitions.
0111100 ... - 6 reps.
0111101 ... - 7 repetitions.
etc.
01111111110 ... - 14 repetitions.
01111111111 ... - 15 repetitions.
011001 ... - From 16 to 255 repetitions (in Hilbert buy flow -
the number of repetitions). 011001 ... - From 256 to 4097
repetitions (in the ba ytovom flow: first byte, then
low byte of the number of repeats. It is obvious that
significant byte is always less than 16, which enables
us to distinguish the sequence of the of the previous case).
011001 - is also the end of the file, if the byte in
byte stream is zero. From this,
Specifically, it follows that the last byte of the UPA forged
block is always zero.
Above under the ellipsis to understand the following
statement disp'a (negative):
1 - disp8 (# ff00-ffff) in a byte stream.
011x - disp9 (# fd00-feff), where x - Senior
discharge (0 corresponds to # fd), the remaining 8
- A byte stream.
010xx - disp10 (# f900-fcff), where xx - a hundred
rshie level (00 matches # f9), the remainder would be 8 - in
a byte stream. 001xxx - disp11 (# f100-# f8ff), where xxx -
senior level (000 matches # f1),
the other 8 - in a byte stream.
000xxxx - disp12 (# e200-# f0ff), where xxxx -
significant bits (0000 corresponds to # e2),
the other 8 - in a byte stream.
0000000 - disp16, stored in a byte on a stream, first byte,
and then junior.
v2.3/Hrip:
File is divided into blocks. Each
Block your zagolovok.Bloki may be of varying lengths.
Preferably, however, that the length Block was a multiple of #
100. Just packed file is longer than # a000 also splits
into blocks. Successively recorded units
form a compressed file, and the sequence of compressed files -
archive.
Header Block:
-------------------+ 0 (5) - "Hrst2".
5 (1) - byte flags:
bit0 = 1: The block is saved without compression;
bit1 = 1: block in the file was the last;
bit5 = 1: a file is deleted.
6 (2) - the length of the original block.
8 (2) - the length of the packaged unit (with no length
header). +10 (1) - the length of additional information:
---- 11 (2) - CRC16 packaged unit (can be
quickly verify the safety of the archive);
13 (2) - CRC16 original block;
+15 (14) - file descriptor (as in TR-DOS).
----+[+ 10] 11 (take a byte from [10], we add
11) - packed block.
The length of the additional information is:
= 0 for simply packed files;
= 2 + want to have a CRC16 packaged unit;
= 4 + also know CRC16 original block;
= 18 + know the file name.
In Hrip maximum block size - 16k
without a title. Header occupies 29 bytes.
The header block contains the following additional information:
CRC packaged, CRC Source, a copy of the title from the
directory.
Parameter in the header file corresponding to
for the real length of the block should be a multiple
256.
Header file:
------------------- IDARCH DB "HRi"
IDALL DB 0; number of files in the archive
; (Used in Hrip'e with the addition of
; Archives that there was no more than 255 files)
SMESH DB 0; see later
LAST DW 0; see later
CAT DB 0, 1 - catalog is in the archive,
; 0 - Catalogue no.
The following formula shows how you can
determine the end of the archive (in bytes from the beginning
of the archive): END_ARCH = [LAST] * 256 - (256 - [SMESH])
bytes
Location of the directory, if present, can be determined by
the formula:
START_CAT = [LAST] * 256 bytes
Format::
-------------------
Title directory:
IDCAT DB "Hrip"
FILES DB 0; files in archive = IDALL
SECLEN DB 0; length of directory sectors.
Next comes a list of files in the archive in
the following format:
IDFILE DS 11; filename
SMSEC DW 0; on many sectors of
; Beginning of the archive file is located
SMBYTE DB 0; in which byte in the sector
LENPACK DB 0; length pack. file in the sectors
LENREAL DB 0; actual length of the file in sects.
File offset from the beginning of the archive is calculated
as follows:
SM_FILE = [SMSEC] * 256 + [SMBYTE] bytes
Number of files specified in the variable
FILES (title catalog), but that's not necessary that a 0 after
the last file descriptor.
Prepared by Coder
Other articles:
Similar articles:
В этот день... 14 December