Mail Archives: djgpp/1996/06/26/02:50:20
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 -