ACNews #11
25 сентября 2002

Guide - The format of the packed file Hrust 2.1

<b>Guide</b> - The format of the packed file Hrust 2.1
■ ■ ■ ■ ■ ■ ■ ■ ■

  ■ ■ ■ ■ ■ ■ ■ ■ ■ ■


              The format of the packed file Hrust 2.1:


                         -= Title =
shift length

  0 3 "hr2" sign

  3 1 "1" is reserved.

                 if bit7 = 1, then the file has been

                 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 
itself These 6 bytes are not packed.



   Byte at offset 3 zarezervirovan.V this version of the packer
there is written "1", and depaker DEHR21 also takes into 
account the bit7 of the byte. If it is enabled, then the file 
was just saved without compression.



                         -= Body file =

   The body of the file is stored immediately two streams - bit 
and byte. Byte contains the name that is understandable, whole 
bytes are stored with as many as byte addresses. The bitstream 
is placed among these bytes the first byte in the packed block 
- nepakovanny first byte file, the next byte belongs to the 
bitstream, the next bytes of a bitstream selected from a 
pointer to the byte stream after which the pointer is 
incremented. 

   Used method of compression of type LZSS. Bitstream is
control and contain codes that indicate the format of data byte
flow. Coded link back to the repeat station data. The maximum 
length of a repeating fragment encoded by a single reference - 
4,095 bytes (# fff). Maximum back reference =- 65535 bytes (but 
window in the packer = 16384 bytes, and decreases when 
approaching the packed piece of nepakovannomu - packaging is in 
the same buffer) 


   So:

(Disp - it _otritsatelnoe_ offset in bytes between the old and 
new occurrence of the same sequence. Disp'a numerals denote the 
bit. "The number of repetitions - the length of this sequence.) 

011000nnnn - nepakovannyh few bytes, to be exact, 12 + nnnn * 2
 bytes (not more than 42, as can be seen) in a byte stream - 
these bytes. 1 - just one nepakovanny bytes (a byte stream - 
this  bytes).

000xxx - a repetition (xxx = disp3).
001 - 2 repeat (in a 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 repeats (in a byte stream - the 
number of  these repeats)

011001 ... - From 256 to 4,097 repeats (in a byte stream - first
 byte, then low byte of the number of repeats. It is obvious 
that  significant byte is always less than 16, which allows to 
distinguish the sequence from the previous case). 011001 - is 
also the end of the file, if the byte in the byte stream is  
zero. From this, in particular, that the last byte of the 
packed Nogo block is always zero. 


   Unused bits in last byte of the bitstream clogged with 
zeros, although it does not matter. Significance is the fact 
that the bits are selected from this flow from left to right 
(first - 7-bit bytes, then - 6-th, etc.)



   Above under the ellipsis to understand the following 
statement disp'a: 

1 - disp8 (# ff00-ffff) in a byte stream.
011x - disp9 (# fd00-feff), where x - MSB (0 corresponds to the 
# fd), the other 8 - in a byte stream. 010xx - disp10 (# 
f900-fcff), where xx - significant bits (00 corresponds to # 
f9), the other 8 - in a byte stream. 001xxx - disp11 (# f100-# 
f8ff), where xxx - the senior level (000  corresponds to the # 
f1), the other 8 - in a byte stream. 000xxxx - disp12 (# e300-# 
f0ff *), where xxxx - senior level  (0010 corresponds to # e3), 
the other 8 - in a byte stream. 0000000 - disp16, stored in a 
byte stream, first senior  bytes, and then junior.

______
* Here I do not understand why the shift in the range # e200-# 
e2ff not encoded 12-bit code (0000001). It will be good if 
there hrumer and explain everything:) -----


   Adding just to avoid confusion: block format Hrust2.3
(Hrip) is the same as in Hrust2.1, except the title.


   All of the above information was obtained by studying the 
code of the program Hrust 2.1. 


   Waiting for additions and comments! if it is not clear, try 
to restate:) 




Other articles:

News - local news.

Guide - The format of the packed file Hrust 2.1

Docs - A new version of the monitor debugger STS 5.3.

Fun - your mother at all what I wanted to write here? Who made Lamergy?

Honor and Eternal - List of Honored Members AC Edit.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Others - Bugs writing to floppy disks. Causes and methods of struggle.
From the world of bat - an overview of reading mail: standardization issues, problems IS-DOS, etc.

В этот день...   6 May