source.by

PCX Format - ModdingWiki

Source 2020: http://www.shikadi.net/moddingwiki/PCX_Format | 2020-02-10

        <!DOCTYPE html>
<html lang="en-GB" dir="ltr" class="client-nojs">
<head>
<meta charset="UTF-8" />
<title>PCX Format - ModdingWiki</title>
<meta name="generator" content="MediaWiki 1.24.1" />
<link rel="ExportRDF" type="application/rdf+xml" title="PCX Format" href="/wiki/modding/index.php?title=Special:ExportRDF/PCX_Format&xmlmime=rdf" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" href="/wiki/modding/opensearch_desc.php" title="ModdingWiki (en-gb)" />
<link rel="EditURI" type="application/rsd+xml" href="http://www.shikadi.net/wiki/modding/api.php?action=rsd" />
<link rel="alternate" hreflang="x-default" href="/moddingwiki/PCX_Format" />
<link rel="alternate" type="application/atom+xml" title="ModdingWiki Atom feed" href="/wiki/modding/index.php?title=Special:RecentChanges&feed=atom" />
<link rel="stylesheet" href="http://www.shikadi.net/wiki/modding/load.php?debug=false&lang=en-gb&modules=ext.geshi.language.asm%7Cext.rtlcite%7Cmediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.skinning.interface%7Cmediawiki.ui.button%7Cskins.vector.styles&only=styles&skin=vector&*" />
<link rel="stylesheet" href="http://www.shikadi.net/wiki/modding/load.php?debug=false&lang=en-gb&modules=ext.smw.style%7Cext.smw.tooltip.styles&only=styles&skin=vector&*" />
<meta name="ResourceLoaderDynamicStyles" content="" />
<link rel="stylesheet" href="http://www.shikadi.net/wiki/modding/load.php?debug=false&lang=en-gb&modules=site&only=styles&skin=vector&*" />
<style>a:lang(ar),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}
/* cache key: shikadi_modwiki:resourceloader:filter:minify-css:7:cdc28caba0323466131c1d06ad224007 */</style>
<script src="http://www.shikadi.net/wiki/modding/load.php?debug=false&lang=en-gb&modules=startup&only=scripts&skin=vector&*"></script>
<script>if(window.mw){
mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"PCX_Format","wgTitle":"PCX Format","wgCurRevisionId":8900,"wgRevisionId":8900,"wgArticleId":1896,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["All file formats","All image formats","CGA images","EGA images","VGA images","Bubble Bobble featuring Rainbow Islands","Crystal Caves","Halloween Harry","Hocus Pocus","Hugo's House of Horrors","Hugo II, Whodunit?","Hugo III, Jungle of Doom!","Math Rescue","Wacky Wheels","Word Rescue"],"wgBreakFrames":false,"wgPageContentLanguage":"en-gb","wgPageContentModel":"wikitext","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgMonthNamesShort":["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"wgRelevantPageName":"PCX_Format","wgIsProbablyEditable":false,"wgRestrictionEdit":[],"wgRestrictionMove":[]});
}</script><script>if(window.mw){
mw.loader.implement("user.options",function($,jQuery){mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"editfont":"default","editondblclick":0,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":1,"extendwatchlist":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"imagesize":2,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nickname":"","norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"rcdays":7,"rclimit":50,"rows":25,"showhiddencats":0,"shownumberswatching":1,"showtoolbar":1,"skin":"vector","stubthreshold":0,"thumbsize":5,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":1,"watchdefault":1,"watchdeletion":0,"watchlistdays":3,"watchlisthideanons":0,"watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"watchrollback":0,
"wllimit":250,"useeditwarning":1,"prefershttps":1,"language":"en-gb","variant-gan":"gan","variant-iu":"iu","variant-kk":"kk","variant-ku":"ku","variant-shi":"shi","variant-sr":"sr","variant-tg":"tg","variant-uz":"uz","variant-zh":"zh","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false,"searchNs100":true,"searchNs101":false,"searchNs104":false,"searchNs105":false,"searchNs106":false,"searchNs107":false,"searchNs110":false,"searchNs111":false,"variant":"en-gb"});},{},{});mw.loader.implement("user.tokens",function($,jQuery){mw.user.tokens.set({"editToken":"+\\","patrolToken":"+\\","watchToken":"+\\"});},{},{});
/* cache key: shikadi_modwiki:resourceloader:filter:minify-js:7:d3bd3aaae551919d8639488aa01d559f */
}</script>
<script>if(window.mw){
mw.loader.load(["ext.smw.style","mediawiki.page.startup","mediawiki.legacy.wikibits","mediawiki.legacy.ajax","skins.vector.js"]);
}</script>
<!--[if lt IE 7]><style type="text/css">body{behavior:url("/wiki/modding/skins/Vector/csshover.min.htc")}</style><![endif]-->
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-PCX_Format skin-vector action-view vector-animateLayout">
		<div id="mw-page-base" class="noprint"></div>
		<div id="mw-head-base" class="noprint"></div>
		<div id="content" class="mw-body" role="main">
			<a id="top"></a>

						<h1 id="firstHeading" class="firstHeading" lang="en-GB"><span dir="auto">PCX Format</span></h1>
						<div id="bodyContent" class="mw-body-content">
									<div id="siteSub">From ModdingWiki</div>
								<div id="contentSub"></div>
												<div id="jump-to-nav" class="mw-jump">
					Jump to:					<a href="#mw-navigation">navigation</a>, 					<a href="#p-search">search</a>
				</div>
				<div id="mw-content-text" lang="en-GB" dir="ltr" class="mw-content-ltr"><div style="border-left: 1em solid white; float: right; clear: right; margin-left: 1em;">
<div class="infobox" style="width: 330px; text-align: left; font-size: 90%; float: none; margin: 0px;">
<div style="text-align:center; font-size: 120%;"><b>PCX Format</b></div>
<div id="map-infobox-image" style="text-align:center;"><a href="/moddingwiki/File:PCX_Format.png" class="image"><img alt="PCX Format.png" src="/wiki/modding/images/2/25/PCX_Format.png" width="320" height="200" /></a><meta itemprop="thumbnailUrl" content="http://www.shikadi.net/moddingwiki/PCX_Format.png" /><br /></div>
<table>
<tr><th style="min-width: 12em;">Format type</th><td style="vertical-align: middle;">Image</td></tr>
<tr><th>Hardware</th><td style="vertical-align: middle;">CGA, EGA, VGA</td></tr>
<tr><th>Colour depth</th><td style="vertical-align: middle;">Multiple</td></tr>
<tr><th>Minimum size (pixels)</th><td style="vertical-align: middle;">0×0</td></tr>
<tr><th>Maximum size (pixels)</th><td style="vertical-align: middle;">65536×65536</td></tr>
<tr><th>Palette</th><td style="vertical-align: middle;">Internal (optional)</td></tr>
<tr><th>Plane count</th><td style="vertical-align: middle;">1-255</td></tr>
<tr><th>Transparent pixels?</th><td style="vertical-align: middle;">No</td></tr>
<tr><th>Hitmap pixels?</th><td style="vertical-align: middle;">No</td></tr>
<tr><th>Games</th><td style="vertical-align: middle; padding-left: 1em; text-indent: -1em;"><div><a href="/moddingwiki/Bubble_Bobble_featuring_Rainbow_Islands" title="Bubble Bobble featuring Rainbow Islands">Bubble Bobble featuring Rainbow Islands</a></div>
   <div><a href="/moddingwiki/Crystal_Caves" title="Crystal Caves">Crystal Caves</a></div>
   <div><a href="/moddingwiki/Halloween_Harry" title="Halloween Harry">Halloween Harry</a></div>
   <div><a href="/moddingwiki/Hocus_Pocus" title="Hocus Pocus">Hocus Pocus</a></div>
   <div><a href="/moddingwiki/Hugo%27s_House_of_Horrors" title="Hugo's House of Horrors">Hugo's House of Horrors</a></div>
   <div><a href="/moddingwiki/Hugo_II,_Whodunit%3F" title="Hugo II, Whodunit?">Hugo II, Whodunit?</a></div>
   <div><a href="/moddingwiki/Hugo_III,_Jungle_of_Doom!" title="Hugo III, Jungle of Doom!">Hugo III, Jungle of Doom!</a></div>
   <div><a href="/moddingwiki/Math_Rescue" title="Math Rescue">Math Rescue</a></div>
   <div><a href="/moddingwiki/Wacky_Wheels" title="Wacky Wheels">Wacky Wheels</a></div>
   <div><a href="/moddingwiki/Word_Rescue" title="Word Rescue">Word Rescue</a></div></td></tr>
</table>
</div></div>
<p>The <strong class="selflink">PCX Format</strong> is an image format used by many games, usually to store full screen (320x200) 16-colour EGA, and later 256-colour VGA (mode 13h), graphics.  It was, for a time, also a general picture format like .bmp or .png, and was the primary format used by PC Paintbrush.  It declined in popularity after support for 24-bit true colour images was added too late, by which time many people had switched to competing formats like .png and JPEG (the latter offering far better compression for photos.)  It also lacks support for transparency, which resulted in it losing some ground to the GIF format which otherwise provided a similar feature set.
</p>
<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#Header"><span class="tocnumber">1</span> <span class="toctext">Header</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Image_Data"><span class="tocnumber">2</span> <span class="toctext">Image Data</span></a>
<ul>
<li class="toclevel-2 tocsection-3"><a href="#RLE_Compression"><span class="tocnumber">2.1</span> <span class="toctext">RLE Compression</span></a></li>
<li class="toclevel-2 tocsection-4"><a href="#Palettes"><span class="tocnumber">2.2</span> <span class="toctext">Palettes</span></a>
<ul>
<li class="toclevel-3 tocsection-5"><a href="#CGA_palette"><span class="tocnumber">2.2.1</span> <span class="toctext">CGA palette</span></a>
<ul>
<li class="toclevel-4 tocsection-6"><a href="#Older_method"><span class="tocnumber">2.2.1.1</span> <span class="toctext">Older method</span></a></li>
<li class="toclevel-4 tocsection-7"><a href="#Newer_method"><span class="tocnumber">2.2.1.2</span> <span class="toctext">Newer method</span></a></li>
</ul>
</li>
<li class="toclevel-3 tocsection-8"><a href="#EGA_palette"><span class="tocnumber">2.2.2</span> <span class="toctext">EGA palette</span></a></li>
<li class="toclevel-3 tocsection-9"><a href="#VGA_palette"><span class="tocnumber">2.2.3</span> <span class="toctext">VGA palette</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1 tocsection-10"><a href="#Source_Code"><span class="tocnumber">3</span> <span class="toctext">Source Code</span></a>
<ul>
<li class="toclevel-2 tocsection-11"><a href="#ASM"><span class="tocnumber">3.1</span> <span class="toctext">ASM</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-12"><a href="#Tools"><span class="tocnumber">4</span> <span class="toctext">Tools</span></a></li>
<li class="toclevel-1 tocsection-13"><a href="#Useful_links"><span class="tocnumber">5</span> <span class="toctext">Useful links</span></a></li>
<li class="toclevel-1 tocsection-14"><a href="#References"><span class="tocnumber">6</span> <span class="toctext">References</span></a></li>
</ul>
</div>

<h2><span class="mw-headline" id="Header">Header</span></h2>
<p>The PCX file is composed of two parts, the header and the image data, which is usually compressed. The header is as follows:
</p>
<table class="wikitable">
<tr>
<th> Data type </th>
<th> Name </th>
<th> Description
</th></tr>
<tr>
<td> <a href="/moddingwiki/UINT8" title="UINT8" class="mw-redirect">UINT8</a> </td>
<td> Manufacturer </td>
<td> Always 0x0A
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT8" title="UINT8" class="mw-redirect">UINT8</a> </td>
<td> Version </td>
<td> PC Paintbrush version. Acts as file format version. <br />0 = v2.5<br />2 = v2.8 with palette<br />3 = v2.8 without palette<br />4 = Paintbrush for Windows<br />5 = v3.0 or higher
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT8" title="UINT8" class="mw-redirect">UINT8</a> </td>
<td> Encoding </td>
<td> Should be 0x01<br />0 = uncompressed image (not officially allowed, but some software supports it)<br />1 = PCX run length encoding
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT8" title="UINT8" class="mw-redirect">UINT8</a> </td>
<td> BitsPerPlane </td>
<td> Number of bits per pixel in each entry of the colour planes (1, 2, 4, 8, 24)
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT16LE" title="UINT16LE" class="mw-redirect">UINT16LE</a> </td>
<td> WindowXmin </td>
<td rowspan="4"> Window (image dimensions):<br />ImageWidth = <tt>Xmax - Xmin + 1</tt><br />ImageHeight = <tt>Ymax - Ymin + 1</tt><br />Normally <tt>Xmin</tt> and <tt>Ymin</tt> should be set to zero. Note that these field values are valid rows and columns, which is why you have to add one to get the actual dimension (so a 200 pixel high image would have Ymin=0 and Ymax=199, or Ymin=100 and Ymax=299, etc.)
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT16LE" title="UINT16LE" class="mw-redirect">UINT16LE</a> </td>
<td> WindowYmin
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT16LE" title="UINT16LE" class="mw-redirect">UINT16LE</a> </td>
<td> WindowXmax
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT16LE" title="UINT16LE" class="mw-redirect">UINT16LE</a> </td>
<td> WindowYmax
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT16LE" title="UINT16LE" class="mw-redirect">UINT16LE</a> </td>
<td> VertDPI </td>
<td rowspan="2"> This is supposed to specify the image's vertical and horizontal resolution in DPI (dots per inch), but it is rarely reliable. It often contains the image dimensions, or nothing at all.
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT16LE" title="UINT16LE" class="mw-redirect">UINT16LE</a> </td>
<td> HorzDPI
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT8" title="UINT8" class="mw-redirect">UINT8</a> </td>
<td> Palette[48] </td>
<td> Palette for 16 colors or less, in three-byte RGB entries. Padded with 0x00 to 48 bytes in total length. See below for more details on palette handling.
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT8" title="UINT8" class="mw-redirect">UINT8</a> </td>
<td> Reserved </td>
<td> Should be set to 0, but can sometimes contain junk.
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT8" title="UINT8" class="mw-redirect">UINT8</a> </td>
<td> ColorPlanes </td>
<td> Number of colour planes. Multiply by <tt>BitsPerPlane</tt> to get the actual colour depth.
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT16LE" title="UINT16LE" class="mw-redirect">UINT16LE</a> </td>
<td> BytesPerPlaneLine </td>
<td> Number of bytes to read for a single plane's scanline, i.e. at least <tt>ImageWidth</tt> ÷ 8 bits per byte × <tt>BitsPerPlane</tt>. Must be an even number. Do <b>not</b> calculate from Xmax-Xmin. Normally a multiple of the machine's native word length (2 or 4)
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT16LE" title="UINT16LE" class="mw-redirect">UINT16LE</a> </td>
<td> PaletteInfo </td>
<td> How to interpret palette:<br />1 = Color/BW<br />2 = Grayscale (ignored in PC Paintbrush IV and later)
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT16LE" title="UINT16LE" class="mw-redirect">UINT16LE</a> </td>
<td> HorScrSize </td>
<td rowspan="2"> Only supported by PC Paintbrush IV or higher; deals with scrolling. Best to just ignore it.
</td></tr>
<tr>
<td> <a href="/moddingwiki/UINT16LE" title="UINT16LE" class="mw-redirect">UINT16LE</a> </td>
<td> VerScrSize
</td></tr>
<tr>
<td> <a href="/moddingwiki/BYTE" title="BYTE" class="mw-redirect">BYTE</a>[54] </td>
<td> Padding </td>
<td> Filler to bring header up to 128 bytes total. Can contain junk.
</td></tr></table>
<h2><span class="mw-headline" id="Image_Data">Image Data</span></h2>
<p>Image data comes after the header (starting at offset 0x80 in a PCX file), and will be RLE compressed if the header indicated so. The way the data is stored depends on how many colour planes are specified. Each row has its color planes stored sequentially, similar to <a href="/moddingwiki/Raw_EGA_data" title="Raw EGA data">raw EGA data</a>.
</p><p>For one plane of eight bits (256-colour), each byte will represent one pixel. For one plane of four bits (16-colour), each byte will represent two pixels. The bits within the byte are in big-endian order, so the most significant bit belongs to the left-most pixel. In other words, in two bits per pixel mode, a byte of value 0xE4 (binary 11 10 01 00) will have left-to-right pixel values of 3, 2, 1, 0.
</p><p>EGA 16-colour images are often stored with four colour planes instead of one, with each plane being one-bit-per-pixel (think of four black and white images, one each for red, green, blue and intensity.)  The planes are stored sequentially for each line (see <a href="/moddingwiki/Raw_EGA_data#Row-planar_EGA_data" title="Raw EGA data">Row-planar EGA data</a> for the exact details), thus a 320x200 EGA image will store at least 40 bytes for each scanline's colour plane (320 pixels ÷ 8 bits per byte × 1 bit per pixel), with each scanline being at least 160 bytes long (320 pixels ÷ 8 bits per byte × 1 bit per pixel × 4 planes). Note that the scanline length can be larger than expected (40 bytes in this example), especially for images whose width is not a multiple of four. This is because each scanline in a plane is padded to a multiple of two or four bytes, depending on the architecture of the machine used to create the file. The actual size is stored in the <tt>BytesPerPlaneLine</tt> field in the header, which should always be used instead of calculating the value from the other image attributes.
</p><p>True colour PCX files are not common, and could be either three planes (R, G and B) of eight bits each (24-bit RGB) or one plane of 24-bits. Technically, the same is applicable for alpha-capable 32-bit images (with four planes in planar mode), though no official format specs ever included such a thing.
</p><p>The split into planes is generally governed by what is most convenient for the game at the time, which in turn depends on which video mode is being used to display the image. Since EGA video memory is split into planes, 16-colour PCX files are frequently split into matching planes so that no processing is required when loading an image directly into video memory.
</p>
<h3><span class="mw-headline" id="RLE_Compression">RLE Compression</span></h3>
<p>The PCX format uses a form of <a href="/moddingwiki/RLE_Compression" title="RLE Compression">RLE Compression</a> that is rather unique. It compresses on the byte level and uses a flag system, where the flag is the two highest bits of a byte. If this flag is set (i.e. the two upper bits are set, or in other words the value is >= 192) then the lower six bits are the number of times to repeat the following byte.
</p><p>Thus, for a  byte pair <tt>C7 28</tt>, the 0xC7 can be decomposed into the flag value 192 (128 + 64) plus 7, meaning the full byte pair means '7 bytes of 0x28'. So to get the amount, you subtract 192 from the flag, or, using faster logic operations, you can do <code>byte & 0x3F</code> to retain only the lowest six bits.
</p><p>This means that the six-bit length values have a maximum of 63. It also means that any value larger than 191 <i>must</i> be stored as a length/value pair, which can actually <i>increase</i> the size of the file in some cases. For instance, if you have a single byte of color 192, then it must be represented by two bytes - one of 193 (C1, a repeat of one time) followed by one of 192 (C0, color byte 192).
</p><p>It is also worth noting that the byte value C0 does not have a clearly defined effect. Depending on the implementation in the decoding program, this could do any of the following:
</p>
<ul><li> treat <tt>C0</tt> as a literal byte.</li>
<li> ignore <tt>C0</tt> and continue with the following byte.</li>
<li> 'repeat the following byte zero times', effectively ignoring any byte following <tt>C0</tt>. This could conceivably be used to embed non-image data in the PCX file which would be ignored by any program displaying the image.</li>
<li> 'repeat the following byte 65536 times', which is basically a bugged implementation using a "<tt>while (--count != 0)</tt>" style loop with a 16 bit variable/CPU register.</li></ul>
<p>At any rate, the best way to handle a <tt>C0</tt> when encoding (compressing) is to write the sequence <tt>C1 C0</tt>. When decoding (decompressing), a value of <tt>C0</tt> almost always indicates an error in the file.
</p><p>Note that each scanline is compressed independently - an RLE sequence may span multiple planes, but it will never span more than one row of pixels. Thus when decompressing an image, the RLE algorithm will produce at most <tt>BytesPerPlaneLine</tt> bytes at a time. Even where the RLE coding could have continued over to the next scanline, it will stop and start again fresh for each line.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>  For example, if the input image is 8×4 pixels EGA 16-colour, and the first two lines of pixels are black (color 0) and the last two are white (color 15), they must be compressed as <tt>C4 00 | C4 00 | C4 FF | C4 FF</tt> and not as <tt>C8 00 | C8 FF</tt>.
</p>
<h3><span class="mw-headline" id="Palettes">Palettes</span></h3>
<p>Most of the game's supported formats are indexed, and thus require a colour palette. There are, however, three distinct ways of handling those palettes; CGA, EGA and VGA. For images with 16 colours or less, the palette is stored in the header. For images with more colours (i.e. 256-colour images) the header palette is ignored, and the 768-byte palette is stored after the image data. Some sources seem to indicate that there are formats where even the smaller palettes are added behind the image, so it is best to always check for it there. To determine if this is the case, check if the decompressed image data is followed by a <tt>0C</tt> byte, and if there is enough data left in the file behind that for the palette data.
</p><p>As a general rule, the palettes are lists of 3-byte blocks. These blocks normally contain 8-bit RGB data, but even if they are used differently (as is the case for CGA palettes), they will still retain the 3-byte block structure.
</p><p>It is difficult to correctly determine the palette for 1-bit and 2-bit images, since they can be stored either as CGA or as VGA, and there is no real way to identify which method to use. Some sources suggest checking for 640x200 dimensions on 1-bit images, or 320x200 on 2-bit, since those are standard CGA sizes for respectively its monochrome and 4-colour mode, but 320x200 is a very common size for non-CGA images as well, and there has most likely never been anything preventing people on CGA hardware from saving PCX images in different sizes than a full screen. It is also suggested, for two bit per pixel images, that those with a single 2-bit plane would use a CGA palette, while those with two 1-bit planes would use VGA<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[2]</a></sup>. All of this makes fully automatic identification for these image types very difficult.
</p>
<h4><span class="mw-headline" id="CGA_palette">CGA palette</span></h4>
<p>CGA palette handling is a bit peculiar. As with other colour palettes, the data is seen as blocks of three bytes. However, in CGA mode, these blocks do not contain normal RGB colour data.
</p><p>The first triplet contains the background colour to be put on palette index #0. Only the highest four bits of the first byte are used, meaning the actual colour value can be found by taking that byte and shifting it four bits to the right. The result is a value from 0..15, which matches <a href="/moddingwiki/EGA_Palette" title="EGA Palette">one of the standard CGA/EGA text-mode colours</a>.
</p><p>For monochrome CGA images, the other entry is filled in with black (EGA palette entry #0), and the palette is complete.
</p><p>For actual 4-colour palettes, three status bits are normally fed into the CGA hardware to determine the rest of the palette:
</p>
<table class="wikitable">
<tr>
<th> Name </th>
<th> Description
</th></tr>
<tr>
<td> ColorBurst </td>
<td> Technically indicates the presence of colour on the palette, but disabling the bit actually causes a switch to Mode 5, which, on colour monitors, gives access to the extra unofficial <b>palette 2</b>.
</td></tr>
<tr>
<td> Palette </td>
<td> Choice between <b>palette 0</b> and <b> palette 1</b>. If <tt>ColorBurst</tt> is disabled, this bit is ignored.
</td></tr>
<tr>
<td> Intensity </td>
<td> Choice between <b>dark</b> (0) or <b>bright</b> (1) version of the palette.
</td></tr></table>
<p>The default palettes are comprised of the following indices on the <a href="/moddingwiki/EGA_Palette" title="EGA Palette">standard EGA palette</a>. The Intensity modifier simply increases all indices by 8 to get the bright equivalents of these colours.
</p>
<table class="wikitable">
<tr>
<th> Palette # </th>
<th> Dark colours  </th>
<th> Bright colours </th>
<th> Description
</th></tr>
<tr>
<td> 0 </td>
<td> [<span style="color: white; background-color: #00AA00">2</span>,<span style="color: white; background-color: #AA0000">4</span>,<span style="color: white; background-color: #AA5500">6</span>] </td>
<td> [<span style="color: black; background-color: #55FF55">10</span>,<span style="color: black; background-color: #FF5555">12</span>,<span style="color: black; background-color: #FFFF55">14</span>]</td>
<td> Mode 4, palette 0
</td></tr>
<tr>
<td> 1 </td>
<td> [<span style="color: white; background-color: #00AAAA">3</span>,<span style="color: white; background-color: #AA00AA">5</span>,<span style="color: black; background-color: #AAAAAA">7</span>] </td>
<td> [<span style="color: black; background-color: #55FFFF">11</span>,<span style="color: black; background-color: #FF55FF">13</span>,<span style="color: black; background-color: #FFFFFF">15</span>]</td>
<td> Mode 4, palette 1
</td></tr>
<tr>
<td> 2 </td>
<td> [<span style="color: white; background-color: #00AAAA">3</span>,<span style="color: white; background-color: #AA0000">4</span>,<span style="color: black; background-color: #AAAAAA">7</span>] </td>
<td> [<span style="color: black; background-color: #55FFFF">11</span>,<span style="color: black; background-color: #FF5555">12</span>,<span style="color: black; background-color: #FFFFFF">15</span>]</td>
<td> The unofficial Mode 5 palette, accessed by disabling <tt>ColorBurst</tt>.
</td></tr></table>
<p>However, the way these three bits are determined changed in PC Paintbrush version IV, and this change is not reflected in a change in the <tt>Version</tt> value in the header. The only decent way to distinguish the files from before and after version IV is to check the <tt>PaletteInfo</tt> byte in the header, which is 0 on files using the old method, and filled in (with 1 or 2) on files using the new method.
</p>
<h5><span class="mw-headline" id="Older_method">Older method</span></h5>
<p>In the original way the status bits were saved, the second palette entry's first byte (byte 3) contains the three status bits.<sup id="cite_ref-fileformat_3-0" class="reference"><a href="#cite_note-fileformat-3">[3]</a></sup> They can be extracted by taking the highest three bits of that byte.
</p>
<ul><li> Bit 8 (<tt>10000000</tt>) is <tt>ColorBurst</tt>.</li>
<li> Bit 7 (<tt>01000000</tt>) is the <tt>Palette</tt>.</li>
<li> Bit 6 (<tt>00100000</tt>) is the <tt>Intensity</tt>.</li></ul>
<h5><span class="mw-headline" id="Newer_method">Newer method</span></h5>
<p>For the newer files, with the <tt>PaletteInfo</tt> byte filled in, the following<sup id="cite_ref-4" class="reference"><a href="#cite_note-4">[4]</a></sup><sup id="cite_ref-5" class="reference"><a href="#cite_note-5">[5]</a></sup> should be done to determine the palette:
</p>
<ul><li> Take the green and blue values of the second palette entry. These are the bytes at index 4 and 5 in the palette data.</li>
<li> If the green value is strictly-greater than the blue value, take Palette 0, otherwise take Palette 1.</li>
<li> If the largest of these two values is greater than 200, the Intensity bit is enabled.</li></ul>
<p>The new method seemed to have been intended to convert a fully-saved colour palette back to CGA status bits. Sadly, it seems people figured out exactly what it checked, and started writing PCX files which contained only exactly enough data to derive those bits instead of saving an actual full palette.
</p><p>As a side effect of this, there is no real check for the color burst, meaning it is always considered to be enabled, and there is no support for palette 2. If an actual palette is saved in the file, such support <i>could</i> be added. A viable check for detecting palette 2 (meaning, a disabled colour burst bit) would be that the original logic matches palette 1, and the third entry's red value is greater than its blue value.
</p>
<h4><span class="mw-headline" id="EGA_palette">EGA palette</span></h4>
<p>EGA images are those with eight or sixteen colours. Typically, they have <tt>BitsPerPlane</tt> set to 1 and <tt>ColorPlanes</tt> set to 3 or 4, though variations like two 2-bit planes or one 4-bit plane are possible as well. For these images, there are two ways of handling the colours:
</p>
<ul><li> If the version in the header is 0 or 3, then the <a href="/moddingwiki/EGA_Palette" title="EGA Palette">standard EGA palette</a> is used, since version 0 does not support a modified palette, and version 3 specifically indicates that no palette information is present in the file.<sup id="cite_ref-fileformat_3-1" class="reference"><a href="#cite_note-fileformat-3">[3]</a></sup></li>
<li> In any other version, the palette is read from the header. The data is structured the same way as <a href="/moddingwiki/VGA_Palette#The_.22Modern.22_format" title="VGA Palette">8-bit VGA palettes</a>, except that it's less long.</li></ul>
<p>Most EGA images will be 4 bits per pixel, meaning the palette will be 16 colours long, but 3 bit per pixel planar format is supported as well. In that case, only 8 entries are read, or if it uses the default EGA palette, only the darker first eight colours will be available. 2 bit per pixel images could use EGA palette handling as well, but these are hard to distinguish from the CGA ones.
</p><p>Note that technically, EGA images are limited to 2 bit colour components, meaning every component would need to be rounded to the nearest multiple of <tt>0x55</tt>, though, practically, there is little reason to not let the images retain the more accurate colours as they are specified in the palette.
</p>
<h4><span class="mw-headline" id="VGA_palette">VGA palette</span></h4>
<p>For 8-bit images, the 256-colour palette can be found behind the image data. It is a <a href="/moddingwiki/VGA_Palette#The_.22Modern.22_format" title="VGA Palette">standard VGA palette in 8-bit RGB format</a>. A single signature byte of <tt>0C</tt> is included before the palette data begins.
</p><p>Some PCX readers simplify the start offset of the 256-colour palette to <code>EndOfFile - 768</code>, though technically, the correct way to find it is to take the offset you end up at after decompressing the image, checking for the <tt>0C</tt> byte after that, and then reading the 768-byte palette.
</p>
<h2><span class="mw-headline" id="Source_Code">Source Code</span></h2>
<h3><span class="mw-headline" id="ASM">ASM</span></h3>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr"><div class="asm source-asm"><pre class="de1"><span class="kw5">EXTERN</span>  kbdin<span class="sy1">,</span> dosxit           <span class="co1">; LIB291 functions</span>
 
<span class="kw5">SEGMENT</span> ScratchSeg
ScratchPad      <span class="kw5">resb</span> <span class="nu0">65535</span>
 
<span class="kw5">SEGMENT</span> stkseg <span class="kw5">STACK</span>
        <span class="kw5">resb</span>    <span class="nu0">64</span><span class="sy1">*</span><span class="nu0">8</span>
stacktop<span class="sy1">:</span>
        <span class="kw5">resb</span>    <span class="nu0">0</span>
 
<span class="kw5">SEGMENT</span> <span class="kw5">code</span>
 
PCX1    <span class="kw5">db</span>      <span class="st0">'my_pcx1.pcx'</span><span class="sy1">,</span> <span class="nu0">0</span>        <span class="co1">; Filenames</span>
PCX2    <span class="kw5">db</span>      <span class="st0">'my_pcx2.pcx'</span><span class="sy1">,</span> <span class="nu0">0</span>        <span class="co1">; (Must end with 0 byte)</span>
 
<span class="kw5">..start</span><span class="sy1">:</span>
        <span class="kw1">mov</span>     <span class="kw4">ax</span><span class="sy1">,</span> <span class="kw4">cs</span>          <span class="co1">; Set up data and stack segments</span>
        <span class="kw1">mov</span>     <span class="kw4">ds</span><span class="sy1">,</span> <span class="kw4">ax</span>
        <span class="kw1">mov</span>     <span class="kw4">ax</span><span class="sy1">,</span> stkseg
        <span class="kw1">mov</span>     <span class="kw4">ss</span><span class="sy1">,</span> <span class="kw4">ax</span>
        <span class="kw1">mov</span>     <span class="kw4">sp</span><span class="sy1">,</span> stacktop
 
MAIN<span class="sy1">:</span>
        <span class="co1">; Sets up mode 13h and clears screen</span>
        <span class="kw1">mov</span>     <span class="kw4">ax</span><span class="sy1">,</span> <span class="nu0">0013h</span>
        <span class="kw1">int</span>     <span class="nu0">10h</span>
 
        <span class="kw1">mov</span>     <span class="kw4">dx</span><span class="sy1">,</span> pcx1        <span class="co1">; Filename to display</span>
        <span class="kw1">call</span>    ShowPCX         <span class="co1">; Display PCX file to screen</span>
 
        <span class="co1">; Wait for keypress</span>
        <span class="kw1">call</span>    kbdin
 
        <span class="co1">; Go back to text mode</span>
        <span class="kw1">mov</span>     <span class="kw4">ax</span><span class="sy1">,</span> <span class="nu0">0003h</span>
        <span class="kw1">int</span>     <span class="nu0">10h</span>
 
        <span class="co1">; Return to DOS</span>
        <span class="kw1">call</span>    dosxit
 
<span class="co1">;-----------------------------------------------------------------------------</span>
<span class="co1">; ShowPCX procedure by Brandon Long,</span>
<span class="co1">;   modified by Eric Meidel and Nathan Jachimiec,</span>
<span class="co1">;   converted to NASM, cleaned up, and better commented by Peter Johnson</span>
<span class="co1">; Inputs: DX has the offset of PCX filename to show.</span>
<span class="co1">; Output: PCX file displayed (all registers unchanged)</span>
<span class="co1">; Notes:  Assumes PCX file is 320x200x256.</span>
<span class="co1">;         Uses ScratchSeg for temporary storage.</span>
<span class="co1">;         The PCX file must be in the same directory as this executable.</span>
<span class="co1">;-----------------------------------------------------------------------------</span>
ShowPCX
        <span class="kw1">push</span>    <span class="kw4">ax</span>              <span class="co1">; Save registers</span>
        <span class="kw1">push</span>    <span class="kw4">bx</span>
        <span class="kw1">push</span>    <span class="kw4">cx</span>
        <span class="kw1">push</span>    <span class="kw4">si</span>
        <span class="kw1">push</span>    <span class="kw4">di</span>
        <span class="kw1">push</span>    <span class="kw4">es</span>
 
        <span class="kw1">mov</span>     <span class="kw4">ax</span><span class="sy1">,</span> <span class="nu0">3D00h</span>
        <span class="kw1">int</span>     <span class="nu0">21h</span>             <span class="co1">; Open file</span>
        <span class="kw1">jc</span>      <span class="sy1">.</span>error          <span class="co1">; Exit if open failed</span>
 
        <span class="kw1">mov</span>     <span class="kw4">bx</span><span class="sy1">,</span> <span class="kw4">ax</span>          <span class="co1">; File handle</span>
        <span class="kw1">mov</span>     <span class="kw4">cx</span><span class="sy1">,</span> <span class="nu0">65535</span>       <span class="co1">; Number of bytes to read</span>
        <span class="kw1">mov</span>     <span class="kw4">ax</span><span class="sy1">,</span> ScratchSeg  <span class="co1">; DS:DX -> buffer for data</span>
        <span class="kw1">mov</span>     <span class="kw4">ds</span><span class="sy1">,</span> <span class="kw4">ax</span>
        <span class="kw1">mov</span>     <span class="kw4">dx</span><span class="sy1">,</span> ScratchPad
        <span class="kw1">mov</span>     <span class="kw4">si</span><span class="sy1">,</span> <span class="kw4">dx</span>
        <span class="kw1">mov</span>     <span class="kw4">ah</span><span class="sy1">,</span> <span class="nu0">3Fh</span>
        <span class="kw1">int</span>     <span class="nu0">21h</span>             <span class="co1">; Read from file</span>
 
        <span class="kw1">mov</span>     <span class="kw4">ax</span><span class="sy1">,</span> <span class="nu0">0A000h</span>      <span class="co1">; Start writing to upper-left corner</span>
        <span class="kw1">mov</span>     <span class="kw4">es</span><span class="sy1">,</span> <span class="kw4">ax</span>          <span class="co1">; of graphics display</span>
        <span class="kw1">xor</span>     <span class="kw4">di</span><span class="sy1">,</span> <span class="kw4">di</span>
 
        <span class="kw1">add</span>     <span class="kw4">si</span><span class="sy1">,</span> <span class="nu0">128</span>         <span class="co1">; Skip header information</span>
 
        <span class="kw1">xor</span>     <span class="kw4">ch</span><span class="sy1">,</span> <span class="kw4">ch</span>          <span class="co1">; Clear high part of CX for string copies</span>
 
<span class="sy1">.</span>nextbyte<span class="sy1">:</span>
        <span class="kw1">mov</span>     <span class="kw4">cl</span><span class="sy1">,</span> <span class="br0">[</span><span class="kw4">si</span><span class="br0">]</span>        <span class="co1">; Get next byte</span>
        <span class="kw1">cmp</span>     <span class="kw4">cl</span><span class="sy1">,</span> <span class="nu0">0C0h</span>        <span class="co1">; Is it a length byte?</span>
        <span class="kw1">jb</span>      <span class="sy1">.</span>normal         <span class="co1">;  No, just copy it</span>
        <span class="kw1">and</span>     <span class="kw4">cl</span><span class="sy1">,</span> <span class="nu0">3Fh</span>         <span class="co1">; Strip upper two bits from length byte</span>
        <span class="kw1">inc</span>     <span class="kw4">si</span>              <span class="co1">; Advance to next byte - color byte</span>
        <span class="kw1">lodsb</span>                   <span class="co1">; Get color byte into AL from [SI]</span>
        <span class="kw1">rep</span> <span class="kw1">stosb</span>               <span class="co1">; Store to [ES:DI] and inc DI, CX times</span>
        <span class="kw1">jmp</span>     short <span class="sy1">.</span>tst
 
<span class="sy1">.</span>normal<span class="sy1">:</span>
        <span class="kw1">movsb</span>                   <span class="co1">; Copy color value from [SI] to [ES:DI]</span>
 
<span class="sy1">.</span>tst<span class="sy1">:</span>
        <span class="kw1">cmp</span>     <span class="kw4">di</span><span class="sy1">,</span> <span class="nu0">320</span><span class="sy1">*</span><span class="nu0">200</span>     <span class="co1">; End of file? (written 320x200 bytes)</span>
        <span class="kw1">jb</span>      <span class="sy1">.</span>nextbyte
 
        <span class="kw1">mov</span>     <span class="kw4">cl</span><span class="sy1">,</span> <span class="br0">[</span><span class="kw4">si</span><span class="br0">]</span>
        <span class="kw1">cmp</span>     <span class="kw4">cl</span><span class="sy1">,</span> <span class="nu0">0Ch</span>         <span class="co1">; Palette available?</span>
        <span class="kw1">jne</span>     <span class="sy1">.</span>close
 
        <span class="co1">; Set palette using port I/O</span>
        <span class="kw1">mov</span>     <span class="kw4">dx</span><span class="sy1">,</span> <span class="nu0">3C8h</span>
        <span class="kw1">mov</span>     <span class="kw4">al</span><span class="sy1">,</span> <span class="nu0">0</span>
        <span class="kw1">out</span>     <span class="kw4">dx</span><span class="sy1">,</span> <span class="kw4">al</span>
        <span class="kw1">inc</span>     <span class="kw4">dx</span>              <span class="co1">; Port 3C9h</span>
        <span class="kw1">mov</span>     <span class="kw4">cx</span><span class="sy1">,</span> <span class="nu0">256</span><span class="sy1">*</span><span class="nu0">3</span>       <span class="co1">; Copy 256 entries, 3 bytes (RGB) apiece</span>
        <span class="kw1">inc</span>     <span class="kw4">si</span>              <span class="co1">; Skip past padding byte</span>
 
<span class="sy1">.</span>palette<span class="sy1">:</span>
        <span class="kw1">lodsb</span>
        <span class="kw1">shr</span>     <span class="kw4">al</span><span class="sy1">,</span> <span class="nu0">1</span>           <span class="co1">; PCX stores color values as 0-255</span>
        <span class="kw1">shr</span>     <span class="kw4">al</span><span class="sy1">,</span> <span class="nu0">1</span>           <span class="co1">;  but VGA DAC is only 0-63</span>
        <span class="kw1">out</span>     <span class="kw4">dx</span><span class="sy1">,</span> <span class="kw4">al</span>
        <span class="kw1">dec</span>     <span class="kw4">cx</span>
        <span class="kw1">jnz</span>     <span class="sy1">.</span>palette
 
<span class="sy1">.</span>close<span class="sy1">:</span>
        <span class="kw1">mov</span>     <span class="kw4">ah</span><span class="sy1">,</span> <span class="nu0">3Eh</span>
        <span class="kw1">int</span>     <span class="nu0">21h</span>             <span class="co1">; Close file</span>
 
<span class="sy1">.</span>error<span class="sy1">:</span>
        <span class="kw1">pop</span>     <span class="kw4">es</span>              <span class="co1">; Restore registers</span>
        <span class="kw1">pop</span>     <span class="kw4">di</span>
        <span class="kw1">pop</span>     <span class="kw4">si</span>
        <span class="kw1">pop</span>     <span class="kw4">cx</span>
        <span class="kw1">pop</span>     <span class="kw4">bx</span>
        <span class="kw1">pop</span>     <span class="kw4">ax</span>
        <span class="kw1">ret</span></pre></div></div>
<h2><span class="mw-headline" id="Tools">Tools</span></h2>
<p>PCX files can be read, and occasionally converted by several programs, notably, the Microsoft Photo Editor included in Windows XP can do so.
</p><p>The following tools are able to work with files in this format.
</p>
<table class="wikitable">
<tr>
  <th>Name</th>
  <th>Platform</th><th>View images in this format?</th>
  <th>Convert/export to another file/format?</th>
  <th>Import from another file/format?</th>
  <th>Access hidden data?</th>
  <th>Edit metadata?</th>
  <th>Notes</th>
</tr>
<tr>
<td><a class="external text" href="http://www.xnview.com">XnView</a></td>
<td>Windows/MacOSX/Linux</td><td style="background-color: #CCFFCC;">Yes</td><td style="background-color: #CCFFCC;">Yes</td><td style="background-color: #CCFFCC;">Yes</td><td style="">N/A</td><td style="">N/A</td>
<td>Freeware for private non-commercial or educational use.</td>
</tr>
<tr>
<td><a class="external text" href="http://www.imagemagick.com">ImageMagick</a></td>
<td>Cross-platform</td><td style="background-color: #CCFFCC;">Yes</td><td style="background-color: #CCFFCC;">Yes</td><td style="background-color: #CCFFCC;">Yes</td><td style="">N/A</td><td style="">N/A</td>
<td>Is unable to correctly write 16-colour PCX files.</td>
</tr>
<tr>
<td><a class="external text" href="http://www.gimp.org">GNU Image Manipulation Program</a></td>
<td>Cross-platform</td><td style="background-color: #CCFFCC;">Yes</td><td style="background-color: #CCFFCC;">Yes</td><td style="background-color: #CCFFCC;">Yes</td><td style="">N/A</td><td style="">N/A</td>
<td>Does not handle CGA or default-palette EGA images correctly.</td>
</tr>
<tr>
<td><a href="/moddingwiki/Engie_File_Converter" title="Engie File Converter">Engie File Converter</a></td>
<td>Windows</td><td style="background-color: #CCFFCC;">Yes</td><td style="background-color: #FFCCCC;">No</td><td style="background-color: #CCFFCC;">Yes</td><td style="">N/A</td><td style="">N/A</td>
<td>Relies on common image dimensions for CGA detection.</td>
</tr>
</table>
<h2><span class="mw-headline" id="Useful_links">Useful links</span></h2>
<ul><li> <a class="external text" href="http://bespin.org/~qz/pc-gpe/pcx.txt">Official PCX documentation</a></li>
<li> <a class="external text" href="http://web.archive.org/web/20030111010058/http://www.nist.fss.ru/hr/doc/spec/pcx.htm">Official PCX documentation in HTML (archived version)</a></li>
<li> <a class="external text" href="http://www.fileformat.info/format/pcx/egff.htm">PCX at the File Format Encyclopaedia</a> - very detailed</li>
<li> <a class="external text" href="http://fileformats.archiveteam.org/wiki/PCX">PCX on the 'Just Solve the File Format Problem' wiki</a> - includes useful sample files.</li></ul>
<h2><span class="mw-headline" id="References">References</span></h2>
<ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text"><a class="external text" href="http://www.drdobbs.com/pcx-graphics/184402396#01ED_0105">PCX Graphics | Dr Dobb's</a></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text"><a class="external text" href="http://www.fysnet.net/pcxfile.htm">PCX graphics files explained</a> - section "Interpretation of the PCX data"</span>
</li>
<li id="cite_note-fileformat-3"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-fileformat_3-0">3.0</a></sup> <sup><a href="#cite_ref-fileformat_3-1">3.1</a></sup></span> <span class="reference-text"><a class="external text" href="https://www.fileformat.info/format/pcx/egff.htm">PCX specs on fileformat.info</a></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><a href="#cite_ref-4">↑</a></span> <span class="reference-text"><a class="external text" href="https://github.com/samuel/go-pcx/blob/d9c017170db4e016377181263f7e4cbb6bf1d8cc/pcx/decoder.go#L299">PCX image encoder and decoder for Go</a> - <i>PC Paintbush 4.0 encodes the CGA palettes differently than 3.0.</i></span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><a href="#cite_ref-5">↑</a></span> <span class="reference-text"><a class="external text" href="https://github.com/wjaguar/mtPaint/blob/3884b6d6ebc18511df7bf1485a19fe774dd61dcf/src/png.c#L5416">Mark Tyler's Painting Program</a> - <i>CGA palette is evil: what the PCX spec describes is the way it was handled by PC Paintbrush 3.0, while 4.0 was using an entirely different, undocumented encoding for palette selection.</i></span>
</li>
</ol>

<!-- 
NewPP limit report
[SMW] In‐text annotation parser time: 0.001 seconds
CPU time usage: 0.237 seconds
Real time usage: 0.257 seconds
Preprocessor visited node count: 926/1000000
Preprocessor generated node count: 2826/1000000
Post‐expand include size: 6495/2097152 bytes
Template argument size: 1810/2097152 bytes
Highest expansion depth: 7/40
Expensive parser function count: 1/100
-->

<!-- Saved in parser cache with key shikadi_modwiki:pcache:idhash:1896-0!*!0!!en-gb!5!* and timestamp 20200305170928 and revision id 8900
 -->
</div>									<div class="printfooter">
						Retrieved from ‘<a dir="ltr" href="http://www.shikadi.net/wiki/modding/index.php?title=PCX_Format&oldid=8900">http://www.shikadi.net/wiki/modding/index.php?title=PCX_Format&oldid=8900</a>’					</div>
													<div id='catlinks' class='catlinks'><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/moddingwiki/Special:Categories" title="Special:Categories">Categories</a>: <ul><li><a href="/moddingwiki/Category:All_file_formats" title="Category:All file formats">All file formats</a></li><li><a href="/moddingwiki/Category:All_image_formats" title="Category:All image formats">All image formats</a></li><li><a href="/moddingwiki/Category:CGA_images" title="Category:CGA images">CGA images</a></li><li><a href="/moddingwiki/Category:EGA_images" title="Category:EGA images">EGA images</a></li><li><a href="/moddingwiki/Category:VGA_images" title="Category:VGA images">VGA images</a></li><li><a href="/wiki/modding/index.php?title=Category:Bubble_Bobble_featuring_Rainbow_Islands&action=edit&redlink=1" class="new" title="Category:Bubble Bobble featuring Rainbow Islands (page does not exist)">Bubble Bobble featuring Rainbow Islands</a></li><li><a href="/moddingwiki/Category:Crystal_Caves" title="Category:Crystal Caves">Crystal Caves</a></li><li><a href="/moddingwiki/Category:Halloween_Harry" title="Category:Halloween Harry">Halloween Harry</a></li><li><a href="/moddingwiki/Category:Hocus_Pocus" title="Category:Hocus Pocus">Hocus Pocus</a></li><li><a href="/moddingwiki/Category:Hugo%27s_House_of_Horrors" title="Category:Hugo's House of Horrors">Hugo's House of Horrors</a></li><li><a href="/moddingwiki/Category:Hugo_II,_Whodunit%3F" title="Category:Hugo II, Whodunit?">Hugo II, Whodunit?</a></li><li><a href="/moddingwiki/Category:Hugo_III,_Jungle_of_Doom!" title="Category:Hugo III, Jungle of Doom!">Hugo III, Jungle of Doom!</a></li><li><a href="/moddingwiki/Category:Math_Rescue" title="Category:Math Rescue">Math Rescue</a></li><li><a href="/moddingwiki/Category:Wacky_Wheels" title="Category:Wacky Wheels">Wacky Wheels</a></li><li><a href="/moddingwiki/Category:Word_Rescue" title="Category:Word Rescue">Word Rescue</a></li></ul></div></div>												<div class="visualClear"></div>
							</div>
		</div>
		<div id="mw-navigation">
			<h2>Navigation menu</h2>

			<div id="mw-head">
									<div id="p-personal" role="navigation" class="" aria-labelledby="p-personal-label">
						<h3 id="p-personal-label">Personal tools</h3>
						<ul>
							<li id="pt-login"><a href="/wiki/modding/index.php?title=Special:UserLogin&returnto=PCX+Format" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o">Log in</a></li><li id="pt-createaccount"><a href="/moddingwiki/Special:RequestAccount">Request account</a></li>						</ul>
					</div>
									<div id="left-navigation">
										<div id="p-namespaces" role="navigation" class="vectorTabs" aria-labelledby="p-namespaces-label">
						<h3 id="p-namespaces-label">Namespaces</h3>
						<ul>
															<li  id="ca-nstab-main" class="selected"><span><a href="/moddingwiki/PCX_Format"  title="View the content page [c]" accesskey="c">Page</a></span></li>
															<li  id="ca-talk"><span><a href="/moddingwiki/Talk:PCX_Format"  title="Discussion about the content page [t]" accesskey="t">Discussion</a></span></li>
													</ul>
					</div>
										<div id="p-variants" role="navigation" class="vectorMenu emptyPortlet" aria-labelledby="p-variants-label">
												<h3 id="p-variants-label"><span>Variants</span><a href="#"></a></h3>

						<div class="menu">
							<ul>
															</ul>
						</div>
					</div>
									</div>
				<div id="right-navigation">
										<div id="p-views" role="navigation" class="vectorTabs" aria-labelledby="p-views-label">
						<h3 id="p-views-label">Views</h3>
						<ul>
															<li id="ca-view" class="selected"><span><a href="/moddingwiki/PCX_Format" >Read</a></span></li>
															<li id="ca-viewsource"><span><a href="/wiki/modding/index.php?title=PCX_Format&action=edit"  title="This page is protected.
You can view its source [e]" accesskey="e">View source</a></span></li>
															<li id="ca-history" class="collapsible"><span><a href="/wiki/modding/index.php?title=PCX_Format&action=history"  title="Past revisions of this page [h]" accesskey="h">View history</a></span></li>
													</ul>
					</div>
										<div id="p-cactions" role="navigation" class="vectorMenu emptyPortlet" aria-labelledby="p-cactions-label">
						<h3 id="p-cactions-label"><span>More</span><a href="#"></a></h3>

						<div class="menu">
							<ul>
															</ul>
						</div>
					</div>
										<div id="p-search" role="search">
						<h3>
							<label for="searchInput">Search</label>
						</h3>

						<form action="/wiki/modding/index.php" id="searchform">
														<div id="simpleSearch">
															<input type="search" name="search" placeholder="Search" title="Search ModdingWiki [f]" accesskey="f" id="searchInput" /><input type="hidden" value="Special:Search" name="title" /><input type="submit" name="fulltext" value="Search" title="Search the pages for this text" id="mw-searchButton" class="searchButton mw-fallbackSearchButton" /><input type="submit" name="go" value="Go" title="Go to a page with this exact name if exists" id="searchButton" class="searchButton" />								</div>
						</form>
					</div>
									</div>
			</div>
			<div id="mw-panel">
				<div id="p-logo" role="banner"><a style="background-image: url(/wiki/config/images/ted5.png);" href="/moddingwiki/Main_Page"  title="Visit the main page"></a></div>
						<div class="portal" role="navigation" id='p-navigation' aria-labelledby='p-navigation-label'>
			<h3 id='p-navigation-label'>Navigation</h3>

			<div class="body">
									<ul>
													<li id="n-mainpage"><a href="/moddingwiki/Main_Page" title="Visit the main page [z]" accesskey="z">Main Page</a></li>
											</ul>
							</div>
		</div>
			<div class="portal" role="navigation" id='p-Games' aria-labelledby='p-Games-label'>
			<h3 id='p-Games-label'>Games</h3>

			<div class="body">
									<ul>
													<li id="n-By-title"><a href="/moddingwiki/Category:Game_Intro_Page">By title</a></li>
													<li id="n-By-company"><a href="/moddingwiki/Category:Game_Company">By company</a></li>
													<li id="n-By-genre"><a href="/moddingwiki/Category:Game_Genres">By genre</a></li>
													<li id="n-Modded"><a href="/moddingwiki/Category:Mods_by_game">Modded</a></li>
													<li id="n-Cheats"><a href="/moddingwiki/Category:Cheat_Codes">Cheats</a></li>
											</ul>
							</div>
		</div>
			<div class="portal" role="navigation" id='p-Modding' aria-labelledby='p-Modding-label'>
			<h3 id='p-Modding-label'>Modding</h3>

			<div class="body">
									<ul>
													<li id="n-Programs"><a href="/moddingwiki/Category:Modding_Tools">Programs</a></li>
													<li id="n-Tutorials"><a href="/moddingwiki/Category:Tutorials">Tutorials</a></li>
													<li id="n-portal"><a href="/moddingwiki/ModdingWiki:Community_portal" title="About the project, what you can do, where to find things">Community portal</a></li>
											</ul>
							</div>
		</div>
			<div class="portal" role="navigation" id='p-Programming' aria-labelledby='p-Programming-label'>
			<h3 id='p-Programming-label'>Programming</h3>

			<div class="body">
									<ul>
													<li id="n-File-formats"><a href="/moddingwiki/Category:File_Formats">File formats</a></li>
											</ul>
							</div>
		</div>
			<div class="portal" role="navigation" id='p-Help_needed' aria-labelledby='p-Help_needed-label'>
			<h3 id='p-Help_needed-label'>Help needed</h3>

			<div class="body">
									<ul>
													<li id="n-Known-info-to-be-added"><a href="/moddingwiki/Category:Stubs">Known info to be added</a></li>
													<li id="n-More-info-needed"><a href="/moddingwiki/Category:Need_more_info">More info needed</a></li>
													<li id="n-Unmoddable-games"><a href="/moddingwiki/Category:Unmoddable">Unmoddable games</a></li>
													<li id="n-Images-needed"><a href="/moddingwiki/Category:Need_pictures">Images needed</a></li>
													<li id="n-Pages-with-TODOs"><a href="/moddingwiki/Category:TODO">Pages with TODOs</a></li>
											</ul>
							</div>
		</div>
			<div class="portal" role="navigation" id='p-Wiki' aria-labelledby='p-Wiki-label'>
			<h3 id='p-Wiki-label'>Wiki</h3>

			<div class="body">
									<ul>
													<li id="n-Editing-guidelines"><a href="/moddingwiki/ModdingWiki:Contributing">Editing guidelines</a></li>
													<li id="n-recentchanges"><a href="/moddingwiki/Special:RecentChanges" title="A list of recent changes in the wiki [r]" accesskey="r">Recent changes</a></li>
													<li id="n-randompage"><a href="/moddingwiki/Special:Random" title="Load a random page [x]" accesskey="x">Random page</a></li>
													<li id="n-help"><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents" title="The place to find out">Help</a></li>
											</ul>
							</div>
		</div>
			<div class="portal" role="navigation" id='p-tb' aria-labelledby='p-tb-label'>
			<h3 id='p-tb-label'>Tools</h3>

			<div class="body">
									<ul>
													<li id="t-whatlinkshere"><a href="/moddingwiki/Special:WhatLinksHere/PCX_Format" title="A list of all wiki pages that link here [j]" accesskey="j">What links here</a></li>
													<li id="t-recentchangeslinked"><a href="/moddingwiki/Special:RecentChangesLinked/PCX_Format" title="Recent changes in pages linked from this page [k]" accesskey="k">Related changes</a></li>
													<li id="t-specialpages"><a href="/moddingwiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q">Special pages</a></li>
													<li id="t-print"><a href="/wiki/modding/index.php?title=PCX_Format&printable=yes" rel="alternate" title="Printable version of this page [p]" accesskey="p">Printable version</a></li>
													<li id="t-permalink"><a href="/wiki/modding/index.php?title=PCX_Format&oldid=8900" title="Permanent link to this revision of the page">Permanent link</a></li>
													<li id="t-info"><a href="/wiki/modding/index.php?title=PCX_Format&action=info">Page information</a></li>
													<li id="t-smwbrowselink"><a href="/moddingwiki/Special:Browse/PCX_Format" rel="smw-browse">Browse properties</a></li>
											</ul>
							</div>
		</div>
				</div>
		</div>
		<div id="footer" role="contentinfo">
							<ul id="footer-info">
											<li id="footer-info-lastmod"> This page was last modified on 16 December 2019, at 08:49.</li>
											<li id="footer-info-viewcount">This page has been accessed 36,901 times.</li>
									</ul>
							<ul id="footer-places">
											<li id="footer-places-privacy"><a href="/moddingwiki/ModdingWiki:Privacy_policy" title="ModdingWiki:Privacy policy">Privacy policy</a></li>
											<li id="footer-places-about"><a href="/moddingwiki/ModdingWiki:About" title="ModdingWiki:About">About ModdingWiki</a></li>
											<li id="footer-places-disclaimer"><a href="/moddingwiki/ModdingWiki:General_disclaimer" title="ModdingWiki:General disclaimer">Disclaimers</a></li>
									</ul>
										<ul id="footer-icons" class="noprint">
											<li id="footer-poweredbyico">
															<a href="//www.mediawiki.org/"><img src="/wiki/modding/resources/assets/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" width="88" height="31" /></a>
															<a href="https://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki"><img src="/wiki/modding/extensions/SemanticMediaWiki/includes/../res/images/smw_button.png" alt="Powered by Semantic MediaWiki" width="88" height="31" /></a>
													</li>
									</ul>
						<div style="clear:both"></div>
		</div>
		<script>/*<![CDATA[*/window.jQuery && jQuery.ready();/*]]>*/</script><script>if(window.mw){
mw.loader.state({"site":"loading","user":"ready","user.groups":"ready"});
}</script>
<script>if(window.mw){
mw.loader.load(["ext.smw.tooltips","ext.cite","mediawiki.toc","mediawiki.action.view.postEdit","mediawiki.user","mediawiki.hidpi","mediawiki.page.ready","mediawiki.searchSuggest"],null,true);
}</script>
<script>if(window.mw){
document.write("\u003Cscript src=\"http://www.shikadi.net/wiki/modding/load.php?debug=false\u0026amp;lang=en-gb\u0026amp;modules=site\u0026amp;only=scripts\u0026amp;skin=vector\u0026amp;*\"\u003E\u003C/script\u003E");
}</script>
<script>if(window.mw){
mw.config.set({"wgBackendResponseTime":383});
}</script>
	</body>
</html>
	

HEADER-CODE:


HTTP/1.1 200 OK
Server: nginx/1.2.1
Date: Thu, 14 May 2020 14:39:47 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
X-Powered-By: PHP/5.4.45-0+deb7u2
X-Content-Type-Options: nosniff
Content-language: en-gb
X-UA-Compatible: IE=Edge
Vary: Accept-Encoding, Cookie
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: private, must-revalidate, max-age=0
Last-Modified: Tue, 31 Mar 2020 14:10:17 GMT

IP 173.255.220.46 www.shikadi.net

Website:www.shikadi.net
IP:173.255.220.46
County:US United States
Region:CA California
City:94536 Fremont
Timezone:America/Los_Angeles
html
html5
CSS
CSS3
CSS GRID
Java
CALQUE | Bedeutung im Cambridge Englisch Wörterbuch | Klachten - Woonbron | Lesben - X Moms Movies | Venedig – Wikipedia | Amanusa Fitness und Beauty » Darmstadt » Fitnessstudio » 3 Bewertungen lesen! | ShenZhen RodinBell Technology Co.,Ltd. | https://help.sap.com/saphelp_sfin100/helpdata/de/77/5adcf413ce404a8e8825e1b56a53d0/content.htm | Nouvelles (Bilingues): Amazon.de: Bradbury, Ray: Fremdsprachige Bücher | Fisterra - Wikipedia | /entityexplore?q=htmc&filters=segment%3a"local"&entityListType=Local&carouselRead=True&maxTotalCount=30&ypids=YN8000x503831058%252cYN9002x3103992&eeptype=LocalListing&RefEnabled=1 | AFNI program: 3dLocalstat | OpenCMS 10.5.3 - Cross-Site Scripting - PHP webapps Exploit | https://www.cisco.com/c/dam/en/us/products/collateral/switches/catalyst-9300-series-switches/white-paper-c11-741945.pdf | Stroiki | PATXI.COM | Startseite - FREQCON GmbH