delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/22/22:58:54

Message-ID: <35DF7EF2.60B5C2DF@unb.ca>
Date: Sat, 22 Aug 1998 23:31:15 -0300
From: Endlisnis <s257m AT unb DOT ca>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
To: Nate Eldredge <nate AT cartsys DOT com>
CC: djgpp AT delorie DOT com
Subject: Re: ASM
References: <35D9917C DOT E3FD9686 AT unb DOT ca> <35DF1E88 DOT A56008D2 AT cartsys DOT com>

Nate Eldredge wrote:

> >     Is there any way to load a variable into a register without putting it
> > in the 'input registers' section?
> Yes, just as you describe.

int main(){
 int T=9;
 asm("movl T, %eax");
 }

    How can I make that program compile.  How can I load 'T' into %eax without
using input registers.

> > int add(int a, int b)
> > {
> >  int Ret;
> >  asm ("movl ?a?, %%eax;"
> >       "addl ?b?, %%eax;"
> >       : : "=a" (Ret): "%eax");
> >  return Ret;
> >
> >     Do I have to tell it I killed eax when it was used as an output
> > register?
>
> No.  You may need to add `&' to the constraint, however, so it doesn't
> put any input operands there.

    Could you give me an example of what you mean?

--
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT GeoCities DOT com
          Endlis AT nbnet DOT nb DOT ca




- Raw text -


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