delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/13/19:30:38

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: problem with extended inline asm
Date: Wed, 12 May 1999 21:10:46 -0400
Organization: BrunNet
Lines: 49
Message-ID: <373A2696.96DC729D@unb.ca>
References: <37394A06 DOT BA8BBA94 AT magix DOT com DOT sg>
NNTP-Posting-Host: ftnts2c35.brunnet.net
Mime-Version: 1.0
X-Mailer: Mozilla 4.51 [en] (Win95; U)
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

Chuming wrote:

> Hi there, can anyone help me with the following problems:
>
> 1) when using extended inline asm in djgpp, is the input registers field
> limited
>  to only 10 operands. Is there any way to get around the problem?
>
> eg:
>   __asm__ __volatile__
>   ("
>          /* asm statements*/
>   "
>   :
>   : "g" (x1), "g" (x2), "g" (x3)... until more than 10 inputs
>   : "edi","eax","ecx","ebx","memory"
>   );

    Well, you can only have as many parameters as there are registers.  I
really don't remember what the "g" modifier means, but I would be suprised if
there were more than 10 available registers.

> 2) Is it possible to access C local variables in inline asm?
> eg.  when we're in a function...
>  (void) func(int x,int y )
>  {
>     int z;
>
>    __asm__ __volatile__
>    ("
>        /* can we do something like in intel asm...*/
>        /*  "mov [z],100" or "mov [x],255" etc...*/
>   "
>   );
>  }

    Only by loading them the way you did in the first example.  If you need
more then 10 registers, you can assign some of them as "m" which is for
"memory" (I think, I haven't done this in a long time).  Or you can split you
asm into smaller portions.

--
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT HotMail DOT com
          ICQ: 32959047



- Raw text -


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