BBS: Inland Empire Archive Date: 11-16-92 (08:21) Number: 303 From: HARRY GISH Refer#: NONE To: BOB OEHRLE Recvd: NO Subj: PCX files How to read ?? Conf: (2) Quik_Bas
BO> Would like to find out how Pcx files are organized
BO> so that I can then
BO> use BLOAD to plot on the screen. The files that I
BO> am interested in viewing
BO> are 43830 bytes long. I have copied these files
Why use BLOAD? Just do a PCX reader. It's easier in this case since you are
limiting yourself to a specific situation (when you're
doing a general PCX reader you have to allow for 3 distinct
formats, 2, 16 and 256 color files). All you really need to
do is double-check the absolute size , which is located in
bytes 8-11 from the beginning of the file in the 128 byte
header. The 16 color definitions (which you restore and set
using PALETTE) are in the 48 bytes starting at byte 17, and
are the red, green, and blue intensities respectively.
The actual encoding starts at byte 128 and works this way : If the byte is
greater than 191 it is a multiplier otherwise it is data
{be VERY careful in logicing this out. The multiplier can
be between 1 and 63 only AND the only way to encode a data
value greater than 191 is with a multiplier first. Thus a
one code of data 243 would have to be encoded as a 1
multiplier of 243. This is what makes a 320X200X256 color
PCX, which should be 64000 maximum ... plus resolution and
palette header info ... often baloon up to 70-80K). Anyway,
the data is encoded into groups of 8 pixel values and in 4
"scans". Thus you actually read an X line 4 times,
accumulating the binary values to range from 0 to 15 for each pixel.
--- Maximus/2 2.01wb
* Origin: ACCESS BBS (1:124/2122)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET