Mail Archives: djgpp/1997/08/02/01:02:09
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 -