]> Spectrum 512 compressed
  •  Back 
  •  %Main 
  •  Index 
  •  Cross references 
  •  Help page 
  •  Show info about hypertext 
  •  View a new file 
Topic       : ATARI ST Picture formats
Author      : David Baggett/Jan K⌐upka
Version     : atari_gf.hyp 0.01 (17/09/96)
Subject     : Documentation/File formats
Nodes       : 52
Index Size  : 1328
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : 
@help       : 
@options    : -i -s +y +z
@width      : 75Spectrum 512 Compressed          *.SPC
1 wordword = 2 bytes
          flag word [$5350 or "SP"]
1 wordword = 2 bytes
          reserved for future use [always 0]
1 longlong = 4 bytes
          length of data bit map
1 longlong = 4 bytes
          length of color bit map
<= 32092 bytes  compressed data bit map
<= 17910 bytes  compressed color bit map
<= 50014 bytes  total

  Data compression:
  Compression is via a modified RLERLE = Run Length Encoding
 scheme, similar to DEGAS compressed
and Tiny. The data map is stored as a sequence of records. Each record
consists of a header byte followed by one or more data bytes. The meaning
of the header byte is as follows:

  For a given header byte, x:
      0 <= x <= 127   Use the next x + 1 bytes literally (no repetition)
   -128 <= x <=  -1   Use the next byte -x + 2 times

  The data appears in the following order:
      1. Picture data, bit plane 0, scan lines 1 - 199
      2. Picture data, bit plane 1, scan lines 1 - 199
      3. Picture data, bit plane 2, scan lines 1 - 199
      4. Picture data, bit plane 3, scan lines 1 - 199
  Decompression of data ends when 31840 data bytes have been used.

  Color map compression:
  Each 16-wordword = 2 bytes
 palette is compressed separately.  There are three
palettes for each scan line (597 total).  The color map is stored as a
sequence of records.  Each record starts with a 1-wordword = 2 bytes
 bit vector which
specifies which of the 16 palette entries are included in the data
following the bit vector (1 = included, 0 = not included).  If a palette
entry is not included, it is assumed to be zero (black).  The least
significant bit of the bit vector refers to palette entry zero, while the
most significant bit refers to palette entry 15.  Bit 15 must be zero,
since Spectrum 512 does not use palette entry 15.  Bit 0 should also
be zero, since Spectrum 512 always makes the background color black.
  The words specifying the values for the palette entries indicated in
the bit vector follow the bit vector itself, in order (0 - 15).

NOTE: Regarding Spectrum pictures, Shamus McBride reports the following:

      "... [The Picture Formats List] says bit 15 of the color map vector
      must be zero. I've encountered quite a few files where [bit 15]
      is set (with no associated palette entry)..."