<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.temlib.org/AtariForumWiki/index.php?action=history&amp;feed=atom&amp;title=Spectrum_512_Compressed_file_format</id>
	<title>Spectrum 512 Compressed file format - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.temlib.org/AtariForumWiki/index.php?action=history&amp;feed=atom&amp;title=Spectrum_512_Compressed_file_format"/>
	<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Spectrum_512_Compressed_file_format&amp;action=history"/>
	<updated>2026-05-21T04:39:47Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=Spectrum_512_Compressed_file_format&amp;diff=18273&amp;oldid=prev</id>
		<title>&gt;Lp: New page</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Spectrum_512_Compressed_file_format&amp;diff=18273&amp;oldid=prev"/>
		<updated>2017-01-02T23:54:10Z</updated>

		<summary type="html">&lt;p&gt;New page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
Spectrum 512 (Compressed)    *.SPC&lt;br /&gt;
 &lt;br /&gt;
1 word          flag word [$5350 or &amp;quot;SP&amp;quot;]&lt;br /&gt;
1 word          reserved for future use [always 0]&lt;br /&gt;
1 long          length of data bit map&lt;br /&gt;
1 long          length of color bit map&lt;br /&gt;
&amp;lt;= 32092 bytes  compressed data bit map&lt;br /&gt;
&amp;lt;= 17910 bytes  compressed color bit map&lt;br /&gt;
--------------&lt;br /&gt;
&amp;lt;= 50014 bytes  total&lt;br /&gt;
 &lt;br /&gt;
Data compression:&lt;br /&gt;
 &lt;br /&gt;
   Compression is via a modified run length encoding (RLE) scheme,&lt;br /&gt;
similar to DEGAS compressed and Tiny.  The data map is stored as a&lt;br /&gt;
sequence of records.  Each record consists of a header byte followed by&lt;br /&gt;
one or more data bytes.  The meaning of the header byte is as follows:&lt;br /&gt;
 &lt;br /&gt;
        For a given header byte, x:&lt;br /&gt;
 &lt;br /&gt;
           0 &amp;lt;= x &amp;lt;= 127   Use the next x + 1 bytes literally (no repetition)&lt;br /&gt;
        -128 &amp;lt;= x &amp;lt;=  -1   Use the next byte -x + 2 times&lt;br /&gt;
 &lt;br /&gt;
The data appears in the following order:&lt;br /&gt;
 &lt;br /&gt;
        1. Picture data, bit plane 0, scan lines 1 - 199&lt;br /&gt;
        2. Picture data, bit plane 1, scan lines 1 - 199&lt;br /&gt;
        3. Picture data, bit plane 2, scan lines 1 - 199&lt;br /&gt;
        4. Picture data, bit plane 3, scan lines 1 - 199&lt;br /&gt;
 &lt;br /&gt;
Decompression of data ends when 31840 data bytes have been used.&lt;br /&gt;
 &lt;br /&gt;
Color map compression:&lt;br /&gt;
 &lt;br /&gt;
   Each 16-word palette is compressed separately.  There are three&lt;br /&gt;
palettes for each scan line (597 total).  The color map is stored as a&lt;br /&gt;
sequence of records.  Each record starts with a 1-word bit vector which&lt;br /&gt;
specifies which of the 16 palette entries are included in the data&lt;br /&gt;
following the bit vector (1 = included, 0 = not included).  If a palette&lt;br /&gt;
entry is not included, it is assumed to be zero (black).  The least&lt;br /&gt;
significant bit of the bit vector refers to palette entry zero, while the&lt;br /&gt;
most significant bit refers to palette entry 15.  Bit 15 must be zero,&lt;br /&gt;
since Spectrum 512 does not use palette entry 15.  Bit 0 should also be&lt;br /&gt;
zero, since Spectrum 512 always makes the background color black.&lt;br /&gt;
   The words specifying the values for the palette entries indicated in&lt;br /&gt;
the bit vector follow the bit vector itself, in order (0 - 15).&lt;br /&gt;
&lt;br /&gt;
NOTE:   Regarding Spectrum pictures, Shamus McBride reports the following:&lt;br /&gt;
&lt;br /&gt;
        &amp;quot;... [The Picture Formats List] says bit 15 of the color map vector&lt;br /&gt;
        must be zero. I've encountered quite a few files where [bit 15] is &lt;br /&gt;
        set (with no associated palette entry)...&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
See also [[Spectrum 512 file format]]&lt;br /&gt;
&lt;br /&gt;
Back to [[ST Picture Formats]]&lt;/div&gt;</summary>
		<author><name>&gt;Lp</name></author>
	</entry>
</feed>