Spectrum 512 Compressed          *.SPC
1 word          flag word [$5350 or "SP"]
1 word          reserved for future use [always 0]
1 long          length of data bit map
1 long          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 RLE 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-word 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-word 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)..."