<?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_file_format</id>
	<title>Spectrum 512 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_file_format"/>
	<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=Spectrum_512_file_format&amp;action=history"/>
	<updated>2026-05-21T02:43:08Z</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_file_format&amp;diff=18282&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_file_format&amp;diff=18282&amp;oldid=prev"/>
		<updated>2017-01-02T23:50:58Z</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    *.SPU&lt;br /&gt;
&lt;br /&gt;
80 words        first scan line of picture (unused) -- should be zeroes&lt;br /&gt;
15920 words     picture data (screen memory) for scan lines 1 through 199&lt;br /&gt;
9552 words      3 palettes for each scan line (the top scan line is&lt;br /&gt;
                not included because Spectrum 512 can't display it)&lt;br /&gt;
-----------&lt;br /&gt;
51104 bytes     total&lt;br /&gt;
&lt;br /&gt;
Note that the Spectrum 512 mode's three palette changes per scan&lt;br /&gt;
line allow more colors on the screen than normally possible, but a&lt;br /&gt;
tremendous amount of CPU time is required to maintain the image.&lt;br /&gt;
&lt;br /&gt;
The Spectrum format specifies a palette of 48 colors for each scan line.&lt;br /&gt;
To decode a Spectrum picture, one must be know which of these 48 colors&lt;br /&gt;
are in effect for a given horizontal pixel position.&lt;br /&gt;
&lt;br /&gt;
Given an x-coordinate (from 0 to 319) and a color index (from 0 to 15),&lt;br /&gt;
the following C function will return the proper index into the Spectrum&lt;br /&gt;
palette (from 0 to 47):&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 *  Given an x-coordinate and a color index, returns the corresponding&lt;br /&gt;
 *  Spectrum palette index.&lt;br /&gt;
 *&lt;br /&gt;
 *  by Steve Belczyk; placed in the public domain December, 1990.&lt;br /&gt;
 */&lt;br /&gt;
int &lt;br /&gt;
FindIndex(x, c)&lt;br /&gt;
	int x, c;&lt;br /&gt;
{&lt;br /&gt;
	int x1;&lt;br /&gt;
&lt;br /&gt;
	x1 = 10 * c;&lt;br /&gt;
&lt;br /&gt;
	if (1 &amp;amp; c)		/* If c is odd */&lt;br /&gt;
		x1 = x1 - 5;&lt;br /&gt;
	else			/* If c is even */&lt;br /&gt;
		x1 = x1 + 1;&lt;br /&gt;
&lt;br /&gt;
	if (x &amp;gt;= x1 &amp;amp;&amp;amp; x &amp;lt; x1 + 160) &lt;br /&gt;
		c = c + 16;&lt;br /&gt;
	else if (x &amp;gt;= x1 + 160) &lt;br /&gt;
		c = c + 32;&lt;br /&gt;
&lt;br /&gt;
	return c;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Back to [[ST Picture Formats]]&lt;/div&gt;</summary>
		<author><name>&gt;Lp</name></author>
	</entry>
</feed>