delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/02/01:02:09

From: "Michael Krause" <mkrause AT mail DOT tds DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Inline Assembler
Date: 1 Aug 1997 22:26:54 GMT
Organization: TDS Telecom - Madison, WI
Lines: 31
Message-ID: <01bc9ec9$cde6c780$cf4c89d0@default>
References: <33E18968 DOT 602B AT starnets DOT ro>
NNTP-Posting-Host: mimi2-a14.mill.tds.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

sarmis AT starnets DOT ro wrote in article <33E18968 DOT 602B AT starnets DOT ro>...
> Hello from Romania again !!!
> 
>   I have a real problem with the gcc's inline assembler.
> 
>   I'm trying to develop a GRAPHICS library (for VESA modes) and the GCC
> does things I don't understand. (You'd better look below).

<snip>

>     subl %0, %%edi
>     subl $1, %1
>     jnc __oneline_bar__
>   "
>   :
>   :"D"(video_address + 640 * y + x), "a"(color), "r"(w), "r"(h)
>   :"%edi", "%ecx"
>   );
> }

<snip>

>     subl %edi, %edi                             ;   Why does the GCC
> replace %0 with %edi ?

Because you told it to.  %0 refers to the first variable in the output and
input lists, in this case video_address + 640 * y + x.  The "D" tells GCC
to automatically load that variable into edi.  So, the line subl %0, %%edi
is the same as subl %%edi, %%edi.  You might want to check out Brennan's
Guide to Inline Assembly.  It's at http://www.rt66.com/~brennan/djgpp/

- Raw text -


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