Xref: news2.mv.net comp.os.msdos.djgpp:2146 From: korpela AT islay DOT ssl DOT berkeley DOT edu (Eric J. Korpela) Newsgroups: comp.os.msdos.djgpp Subject: Re: Is this ASM ok? Date: 25 Mar 1996 19:35:33 GMT Organization: Cal Berkeley-- Space Sciences Lab Lines: 42 Message-ID: <4j6si5$6ak@agate.berkeley.edu> References: <3150B8B2 DOT 8B2 AT jeffnet DOT org> <4ishog$obf AT mack DOT rt66 DOT com> <4ius89$76n AT agate DOT berkeley DOT edu> <4j4q67$h4b AT mack DOT rt66 DOT com> NNTP-Posting-Host: islay.ssl.berkeley.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <4j4q67$h4b AT mack DOT rt66 DOT com>, Brennan "Mr. Wacko" Underwood 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. Click here for more info.