Mail Archives: djgpp/1996/03/25/18:19:32
In article <4j4q67$h4b AT mack DOT rt66 DOT com>,
Brennan "Mr. Wacko" Underwood <brennan AT mack DOT rt66 DOT com> wrote:
>>>asm(
>>> "loopf:\n\t"
>>> "movb %%dh, (%%edi)\n\t" /* write integer portion of color - U1 */
>>> "addl %%ebx, %%edx\n\t" /* Add colstep to col - V1 */
>>> "incl %%edi\n\t" /* increment edi - U2 */
>>> "decl %ecx\n\t" /* decrement count - V2 */
>>> "jnz loopf" /* If ecx not zero goto loop - U3 */
>>> : : "D" (tscreen), "d" (tcol1), "b" (tcolstep), "c" (tlength)/*loaded regs*/
>>> : "%edi", "%ebx", "%ecx", "%edx"); /* clobbered regs */
>
>Oh, I see what you mean about the Info pages. That refers to this register
>loading method: "q" (tscreen) then use %0 for the register name, in case
>GCC was already using eax or whatever you would have picked. Or something
>to that effect. I haven't been able to get that to be useful yet, I just
>specify the registers.
>
That's somewhat confusing. Are you saying that you could also have
written the above as:
asm(
"loopf:\n\t"
"movb %%dh, (%0)\n\t" /* write integer portion of color - U1 */
"addl %2, %1\n\t" /* Add colstep to col - V1 */
"incl %0\n\t" /* increment edi - U2 */
"decl %3\n\t" /* decrement count - V2 */
"jnz loopf" /* If ecx not zero goto loop - U3 */
: : "D" (tscreen), "d" (tcol1), "b" (tcolstep), "c" (tlength)/*loaded regs*/
);
And that in this case, gcc would know the clobbered registers because you used
the %0..%3 macros instead of the explicit names? That's weird. Or am I
misreading what you said?
Eric
--
Eric Korpela | An object at rest can never be
korpela AT ssl DOT berkeley DOT edu | stopped.
<a href="http://www.cs.indiana.edu/finger/mofo.ssl.berkeley.edu/korpela/w">
Click here for more info.</a>
- Raw text -