delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/22/22:54:24

From: Damon Hogan <damonh AT pgmincorporated DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problems with DJGPP lib and grx23
Date: Wed, 22 Dec 1999 18:06:35 -0700
Organization: XMission http://www.xmission.com/
Lines: 122
Message-ID: <3861759A.3A9243F4@pgmincorporated.com>
References: <80h38o$95e$1 AT hudsucker DOT umdac DOT umu DOT se> <4 DOT 2 DOT 0 DOT 58 DOT 19991123114726 DOT 00a46520 AT hal DOT nt DOT tuwien DOT ac DOT at> <833dtxnmlt DOT fsf AT mercury DOT st DOT hmc DOT edu>
NNTP-Posting-Host: mail.pgmincorporated.com
Mime-Version: 1.0
X-Trace: news.xmission.com 945911206 18521 166.70.119.101 (23 Dec 1999 01:06:46 GMT)
X-Complaints-To: abuse AT xmission DOT com
NNTP-Posting-Date: 23 Dec 1999 01:06:46 GMT
X-Mailer: Mozilla 4.6 [en] (Win98; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Since he did not write back, on this I will.  I am having the same problem..

I cannot get the grx23 library to compile on djgpp running under
windows95/98/NT4.   I have the latest gcc for djgpp 295... I have tried
everything I can think of and worked on it for days.  Most everything I
have for djgpp compiles fine but this library and a few others that use
in-line assembly are having this same compile problem.  (Forbidden
registers, AX, CX, DX it doesn't seem to matter.)

gcc -c -O6 -Wall -fomit-frame-pointer -I. -I./include -I../include
-I../addons/p
rint -I../addons/bmp utils/shiftscl.c -o utils/shiftscl.o
utils/shiftscl.c: In function `_GR_shift_scanline':
utils/shiftscl.c:48: Invalid `asm' statement:
utils/shiftscl.c:48: fixed or forbidden register 2 (cx) was spilled for
class CR
EG.
utils/shiftscl.c:102: Invalid `asm' statement:
utils/shiftscl.c:102: fixed or forbidden register 2 (cx) was spilled
for
class C
REG.
make.exe[1]: *** [utils/shiftscl.o] Error 1
make.exe[1]: Leaving directory `c:/djgpp/contrib/grx23/src'
make.exe: *** [libs] Error 2

C:\djgpp\contrib\grx23>


Below is the code it blows up on (src/utils/shiftscl.c), Blowup line
below denoted with a <><>.  Can you tell me what can be done so it will
compile (preferred) or
if you can at lease email me the .a library files for djgpp that would
be sufficient.

Thanks in advance

Damon Hogan
Sr Programmer/Analyst
PGM, Inc.

#     if defined(__GNUC__) && defined(__i386__)
 int w = ws;
 /* sad but true: the x86 bytesex forces this inefficient code :( */
 asm volatile ("\n"
   "   movb    (%3),%%ch    \n"
   "   jmp     1f           \n"
   "   .align  4,0x90       \n"
   "1: decl    %3           \n"
   "   movb    %%ch,%%al    \n"
   "   movb    (%3),%%ah    \n"
   "   movb    %%ah,%%ch    \n"
   "   shrl    %%cl,%%eax   \n"
   "   movb    %%al,(%4)    \n"
   "   decl    %4           \n"
   "   decl    %5           \n"
   "   jne     1b           \n"
   "   shrb    %%cl,%%ch    \n"
   "   movb    %%ch,(%4)      "
   : "=r" ((void *)s), "=r" ((void *)d), "=r" ((int)w)
   : "0" ((void *)s), "1" ((void *)d), "2" ((int)w), "c" ((int)shift)
<><>          : "ax", "cx"
        );
#     elif defined(__TURBOC__)
 asm     push  ds           ;
 asm     mov   bx, ws       ;
 asm     mov   cl, shift    ;
 asm     les   di, d        ;
 asm     lds   si, s        ;
 asm     mov   ch,[si]      ;
 asm     std                ;
  looprv:
 asm     dec   si           ;
 asm     mov   al, ch       ;
 asm     mov   ah, [si]     ;
 asm     mov   ch, ah       ;
 asm     shr   ax, cl       ;
 asm     stosb              ;
 asm     dec   bx           ;
 asm     jnz   short looprv ;
 asm     mov   al, ch       ;
 asm     shr   al, cl       ;
 asm     stosb              ;
 asm     pop   ds           ;
#     else
 int w = ws;
 do {
   --s;
   *(d--) = highlowP(s)>>shift;
 } while (--w);
 *d = *s >> shift;
#     endif

And so it blows up on the line..

 : "ax", "cx"

When throwing away registers at the end of the assembly routine because the
contents of those registers has changed...

Everything I have read so far says that this is valid...  So I can't fix
something that
is supposed to work..

Any suggestions?



Nate Eldredge wrote:

> Anton Helm <tony AT dictator DOT nt DOT tuwien DOT ac DOT at> writes:
>
> > Is there some asm guru out there that can look into a 10-line inline asm
> > code that used to work with gcc 2.8.1 ?
>
> Post it.
>
> --
>
> Nate Eldredge
> neldredge AT hmc DOT edu

- Raw text -


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