

       ------------------------------------------------------------------

						  HUFF XE Compresser v6.10

			Copyright (c) 1988,1989,1990,1991 by FrANK G. Barchard
                Copyright (c) 1992,1993 Electronic Arts Canada

						Documentation - May 31, 1995

       ------------------------------------------------------------------



/*   FILE TYPES (Non-Huffman also)                                  */
/*                                                                  */
/*    The following is a list of Spit applications' file types.     */
/*    Note that as of version 3.66 in Huff, the type is a word.     */
/*                                                                  */
/*   Non-SPIT Types                                                 */
/*   --------------                                                 */
/*                                                                  */
/*      Type  Header   Creator      Description                     */
/*      ----  ------   -------      -----------                     */
/*     0..15   -       -            reserved                        */
/*  5250636b  RPck     runpack 1.1  Amiga/SPIT byte runpack file    */
/*                                                                  */
/*                                                                  */
/*   Ref                                                            */
/*   ---                                                            */
/*                                                                  */
/*      Type  Header   Creator      Description                     */
/*      ----  ------   -------      -----------                     */
/*      10fb  fb5      ref 1.0      backward reference by LinHart   */
/*      11fb  fb5      ref 1.0      ref with unpack len field       */
/*      12fb  fb5      ruf 1.0      gn ref w/huff or stuff literals */
/*      13fb  fb5      ruf 1.0      ruf composite                   */
/*      14fb  fb5      bak codex    back pack source refpack        */
/*      15fb  fb5      bak codex    bakpack composite               */
/*      16fb  fb5      lzh codex    LZHuff based on lha code        */
/*      17fb  fb5      lzh codex    LZHuff composite                */
/*                                                                  */
/*                                                                  */
/*   Huffman                                                        */
/*   -------                                                        */
/*                                                                  */
/*      Type  Header   Creator      Description                     */
/*      ----  ------   -------      -----------                     */
/*        10 len only  huff 2       used for combined header huff   */
/*        11   h0      huff 2       delta header huffman            */
/*        12   h1      huff 2       unpacked header                 */
/*        13   h2      huff 2       gn nx header                    */
/*        14   h3      huff 2       gn (n+1)x header                */
/*        15   h4      huff 2       gn (n+2)x header                */
/*    16..18   -       -            reserved for future use         */
/*        19   l0      huff 3       leapfrog delta header huffman   */
/*        1a   l1      huff 3       unpacked header (same as 18)    */
/*        1b   l2      huff 3       leapfrog gn nx header           */
/*        1c   l3      huff 3       leapfrog gn (n+1)x header       */
/*        1d   l4      huff 3       leapfrog gn (n+2)x header       */
/*    1e..20   -       -            reserved for future use         */
/*        21 len/clues huff 3       run length only                 */
/*        22  gn4      huff 3       general numerics/huff RL        */
/*      23fb  gn4a     huff 3.6     high speed huff                 */
/*      24fb  gn4a2    huff 4.6     huff hs with unpack len field   */
/*      25fb  gn4a3    huff 5.4     ref replaces RL/FB3 header      */
/*      26fb  gn5a3    huff 5.5     gn5 (n)01(n+2)x                 */
/*      27fb  gn5a3    huff 5.5     speed delta 26fb                */
/*      28fb  gn5a3    huff 5.8     acceleration delta 26fb         */
/*      2afb  gn5a3    huff 5.9     FB4 simple huff                 */
/*      2bfb  gn5a3    huff 5.9     FB4 composite huff              */
/*      2cfb  gn5a3    huff 5.9     FB4 simple speed                */
/*      2dfb  gn5a3    huff 5.9     FB4 composite speed             */
/*      2efb  gn5a3    huff 5.9     FB4 simple acceleration         */
/*      2ffb  gn5a3    huff 5.9     FB4 composite acceleration      */
/*     *30fb  fb5      huff 5.9     EOF only huff                   */
/*     *31fb  fb5      huff 5.9      '    '   '   composite         */
/*     *32fb  fb5      huff 5.9     EOF only speed                  */
/*     *33fb  fb5      huff 5.9      '    '   '   composite         */
/*     *34fb  fb5      huff 5.9     EOF only acceleration           */
/*     *35fb  fb5      huff 5.9      '    '   '   composite         */
/*                                                                  */
/*                                                                  */
/*   Btree                                                          */
/*   -----                                                          */
/*                                                                  */
/*      Type  Header   Creator      Description                     */
/*      ----  ------   -------      -----------                     */
/*      40fb  tree     huff 3.6     fbtree packing                  */
/*      41fb  tree2    huff 4.6     fbtree with unpack len field    */
/*      42fb  tree3    huff 5.4     FB3 header (overlap)            */
/*      44fb  tree3    huff 5.9     FB4 simple                      */
/*      45fb  tree3    huff 5.9     FB4 composite                   */
/*     *46fb  tree3    huff 5.9     EOF only simple                 */
/*     *47fb  tree3    huff 5.9     EOF only composite              */
/*                                                                  */
/*                                                                  */
/*   Packed Shape                                                   */
/*   ------------                                                   */
/*                                                                  */
/*      Type  Header   Creator      Description                     */
/*      ----  ------   -------      -----------                     */
/*      50fb  grc      shppack 1.4  ln graphic composite pack       */
/*      51fb  linem    shppack 1.4  ln linemask experimental pack   */
/*                                                                  */
/*                                                                  */
/*   Miscellaneous                                                  */
/*   -------------                                                  */
/*                                                                  */
/*      Type  Header   Creator      Description                     */
/*      ----  ------   -------      -----------                     */
/*      60fb  delta    huff 4.0     delta file                      */
/*      61fb  unit     huff 4.1     unit file (join)                */
/*      62fb  delta2   huff 4.6     delta with unpack len field     */
/*      63fb  profile  huff 4.7     execution pc profile            */
/*      64fb  lnunit   huff 5.1     ln unit file 3 (add)            */
/*      65fb  lnunitB  huff 5.1     true ln unit file 2 (add)       */
/*      66fb  delta3   huff 5.4     FB3 header (overlap)            */
/*      67fb  runpack3 runpack 1.2  amiga runpack with FB3 header   */
/*      68fb  refpack3 refpack 1.0  reference experimental pack     */
/*      69fb  infofile makecar      binary infofile                 */
/*      6afb  unit2    lumpy 1.1    lumpy unit file                 */
/*      6bfb  store    huff 5.7     FB3 header stored file          */
/*      6cfb  lohi     lohi 1.0     lo/hi separated file            */
/*      6dfb  deltaw   deltaw 1.0   word delta file                 */
/*     *6efb  store    huff 5.9     FB4 simple stored file          */
/*     *6ffb  store    huff 5.9     FB4 composite stored file       */
/*     *70fb  lohi     lohi 1.1     FB4 simple                      */
/*     *71fb  lohi     lohi 1.1     FB4 composite                   */
/*     *72fb  delta3   delta 1.1    FB4 simple                      */
/*     *73fb  delta3   delta 1.1    FB4 composite                   */
/*     *74fb  deltaw   deltaw 1.1   FB4 simple                      */
/*     *75fb  deltaw   deltaw 1.1   FB4 composite                   */
/*      76fb  runpack3 runpack 1.3  FB4 simple                      */
/*      77fb  runpack3 runpack 1.3  FB4 composite                   */
/*     *78fb  deltap   deltap 1.0   FB4 simple                      */
/*     *79fb  deltap   deltap 1.0   FB4 composite                   */
/*     *7afb  fb5      runpack 1.3  EOF only                        */
/*     *7bfb  fb5      runpack 1.3  EOF only composite              */
/*                                                                  */
/*                                                                  */
/*  Shape formats (proposed)                                        */
/*  ------------------------                                        */
/*                                                                  */
/*      Type  Header   Creator      Description                     */
/*      ----  ------   -------      -----------                     */
/*      90fb  shp2                  4 bit planar (ega)              */
/*      94fb  shp2                  4 bit packed pixel              */
/*      98fb  shp2                  8 bit packed pixel (mcga)       */
/*      9cfb  shp2                  8 bit non-chain4 (vga)          */
/*      a0fb  shp2                  555 15 bit direct packed pixel  */
/*      a4fb  shp2                  565 16 bit direct packed pixel  */
/*      a8fb  shp2                  888 24 bit direct packed pixel  */
/*      acfb  shp2                  8888 32 bit direct packed pixel */
/*      b0fb  shp2                  8 bit rgb palette               */
/*  b1..bffb                        reserved for future types       */
/*                                                                  */
/*   +1 with 8 bit look up table following                          */
/*   +2 bitmap data is packed (data determines type of packing)     */
/*                                                                  */
/*                                                                  */
/*                                                                  */
/*  Miscellaneous                                                   */
/*  -------------                                                   */
/*                                                                  */
/*      Type  Header   Creator      Description                     */
/*      ----  ------   -------      -----------                     */
/*     *c0fb  unit2    lumpy 5.58   lumpy unit file(same as 6afb)   */
/*		c2fb  shp2					ln2 shape file (intel)			*/
/*		c4fb  shp2					ln2 shape file (motorola)		*/
/*		c6fb  delpkd				video frames in .MVI format 	*/
/*		c8fb  vidcmp				video frames in .VDO format 	*/
/*                                                                  */
/*                                                                  */
/*                                                                  */
/*                                                                  */
/*   * = formats in current version usage                           */
/*   > = formats to be introduced in future                         */
/*                                                                  */



Standardized Header Formats:
----------------------------

Name        Bytes   Format                Notes
----        -----   ------                -----
FB0           1     type                  identifies type of file
FB1           2     type,id               id to help identify type
FB2           5     type,id,ulen          ulen is complete unpack
                                          size for composite packing.
FB3           6     type,id,ulen,overlap  overlap byte to assist in
                                          overlapping buffer unpacking
FB4 simple    5     type,id,len           len is complete unpack size.
                                          no other size if packed once.
FB4 composite 5[+3] type+1,id,ulen,[len]  len is part of packed file
FB5           5[+3] FB4 with EOF          EOF is explicite


Composite packing is when a file is packed with one type of
packing after another.  The ULEN is the unpacked size of the
original file, and is preserved each time the file is
packed.  The length of the file if unpacked once is encoded
separately, within the file and is used only by unpackers.

In FB4 format, the LEN or ULEN field is the complete unpack
size, but if file is composite packed, another length field
will be part of the packed file.  If the file is not
composite packed, no other length field is used.  The type
field identifies if composite packed was used.

The overlap field of the FB3 format has been removed in FB4,
as loaders can use a fixed size overlap(ie 256), and packers
can verify/guarentee that the overlap doesn't overflow that
fixed value.

Pack programs that support composite packing will choose the
header format automatically.

The  low  bit  of the type will be 0 for simple FB4 headers,
and 1 for composite packed FB4 headers.

FB5 type files contain an explicite end-of-file following
the last byte of source data.



BTREE (fb4) header format:
--------------------------

            offset  bytes   notes
id          0       2       id is 42fb
ulen        2       3       total unpacked len
ilen*       2/5     3       unpacked len for this file (for composite packing)
clue        5/8     1
nodes       6/9     1       number of nodes
{
    node    7/10+3n 1
    left    8/11+3n 1
    right   9/12+3n 1
}

[packed data]
[explicitely packed last byte]

* present if composite packed



LUMPY header format:
--------------------

A lumpy file has a single header at the beginning of the file, listing
the contents of the lumpy file.  The format is:

    Field Offset Bytes Comments
    ----- ------ ----- --------
       id    0     2   ($c0fb) identifies file type as lumpy2 format
     hlen    2     2   header length (starting at filen)
    filen    4     2   number of files
   header    6     X   list of unit files (see format below)
    files    X+6   Y   files themselves follow the header

In the header field is information on each file in the lumpy file.
The format for each file in the header is as follows:

    Field Offset Bytes Comments
    ----- ------ ----- --------
   offset    0     3   24 bit offset from start of lumpy file to the file
      len    3     3   24 bit length of the file
     name    6     L   ASCIIZ name of file (optional)
       \0    L+6   1   null terminator for file name
<next field> L+7


Shape File header format:

    All fields in shape file are Motorolla/bigendien/high-low.

    Field Offset Bytes Comments
    ----- ------ ----- --------
       id    0     2   ($c2fb) identifies file type as shape file
      len    2     3   length of file
     type    5     1   default type (same as shape type ids)
      num    6     2   number of shapes in file
  <reserved> 8     8   reserved for future expansion
      ids   16  num*8  ids/offsets

   for each item, the follow pair:
       id    0     4   name of item (usually ascii)
   offset    4     4   long offset (high-low format)



Shape Format:

    Field Offset Bytes Comments
    ----- ------ ----- --------

    width   0      2 width of shape in pixels
   height   2      2 height
  centerx   4      2 center x relative (0,0 upper left of shape)
  centery   6      2 center y
 defaultx   8      2 default x position of shape on background
 defaulty  10      2 default y
     type  12      2 type of shape data (See shape types ie 90fb)
 planepad  14      2 bytes to align planes. for ega and vga only




