www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/01/19/05:57:47

From: Nigel Stephens <algor!nigel>
Date: Tue, 19 Jan 93 10:48:54 GMT
To: H1357Sol AT huella DOT bitnet
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: problem reported by H1357Sol AT huella DOT bitnet

Your first problem with the cmp instruction is a problem with your
debugger or disassembler: I've checked in my intel programmer's ref
manual and this instruction is a correct 32-bit immediate compare 
(CMP Ev, Iv).

Your next problem is that you seem to be assuming that WORD is a
16-bit integer, in which case the following is wrong:

> typedef unsigned int		WORD;

Ints are always 32-bits in GCC (i.e. int == long); you should instead
have:

> typedef unsigned short	WORD;

You will then have the problem that the compiler will force the
alignment of the bfSize member to be on a 32-bit boundary.  You can
change this in GCC 2.3.x by inserting the following line before the
structure definition:

#pragma pack(1)

I'm not sure if this will work with the GCC version in DJGPP, but its
worth a try.  Alternatively there is the non-standard GNU
__attribute__ extension; the following specifies that bfSize should be
aligned on a 2-byte boundary:

	DWORD	bfSize __attribute__ ((aligned (2)));	/* file ... */

--------------------
Nigel Stephens
Algorithmics Ltd		UUCP:	nigel AT algor DOT co DOT uk nigel
3 Drayton Park			  or    nigel%algor DOT co DOT uk AT uknet DOT ac DOT uk
London				OLDUUCP:..!mcsun!uknet!algor!nigel
N5 1NU				PHONE:	(+44) (0)71 700 3301
England				FAX:	(+44) (0)71 700 3400

- Raw text -


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