www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/26/02:50:20

Xref: news2.mv.net comp.os.msdos.djgpp:5384 rec.games.programmer:53807
From: Moo the Cow <sillywiz AT wardrobe DOT demon DOT co DOT uk>
Newsgroups: rec.games.programmer,comp.os.msdos.djgpp
Subject: Re: Help -- Reading PCX Header
Date: Mon, 24 Jun 1996 14:43:41 GMT
Organization: The Wardrobe Happy Cow Emporium.
Lines: 46
Message-ID: <DtIE8u.8F4@wardrobe.demon.co.uk>
References: <4ql5is$a37 AT maggie DOT ionsys DOT com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <4ql5is$a37 AT maggie DOT ionsys DOT com>, MCheu <matrix AT ionsys DOT com> wrote:
>Hi 
>
>Sorry to bother everyone with this, but I've been getting some wierd
>numbers from the following programme.  It's supposed to read the
>header from a pcx file and tell me about it.  The first 4 values from
>the header come through ok (ID, version, encoding, bitdepth), but the
>next 4 (Xmin, Ymin, Xmax, Ymax) are way off.  The last time I ran the
>executable, I got the following:
>
>Xmin = 0
>Ymin =13041983
>Xmax = 13107520
>Ymax = -67108864
>
>I was expecting something along the lines of 0, 0, 319, 199
>respectively.  I've only run this with 256 colour PCX files that are
>320x200 or smaller.   I've compared this  with the  code posted
>recently by Mr. Anderson (from rec.games.programmer) as well as
>sources from the GDM online,  and I "seem" to have done this
>correctly.  Can anyone please tell me where I screwed up?   If it
>helps, I'm compiling with DJGPP version2 under win95.

Real simple guess.. you're reading 32 bit entries when the entries are
only 16 bits long ( designed for the modern PC in its 8086 emulation
mode.. ) I make this guess from the fact your replies won't fit in a 16 bit..

You need to a) declare your structures to be "short int" or b) use a
character manipulation system..

	width=header[n]+header[n+1]*256;

which will have the advantage of porting to other cpus ( the order of
bytes in words not being the same on everything. ) I personally use
the second, for just this reason ( my code has a habit of being lent
to people who compile it on Suns, Mipsels, Macintoshes and who knows
what else & whine if it doesn't work straight off.. )

If you want code I have a module written for GCC which loads PCXs, and
should compile for DJGPP ( it's GOT to eventually.. )

 --------------------------------------------+---------------------------------
"It's not a personality.. it's a bulldozer." | My pet goldfish knows more
Keith Lucas -- sillywiz AT wardrobe DOT demon DOT co DOT uk.| science than Andre Bormanis !
 --------------------------------------------+---------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019