Message-Id: <199903191515.KAA24423@delorie.com> Comments: Authenticated sender is From: "George Foot" To: ams AT ludd DOT luth DOT se (Martin Str|mberg) Date: Fri, 19 Mar 1999 15:12:55 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Some assembly questions CC: djgpp AT delorie DOT com X-mailer: Pegasus Mail for Win32 (v2.42a) Reply-To: djgpp AT delorie DOT com On 18 Mar 99 at 17:45, Martin Str|mberg wrote: > Clark L. Coleman (clc5q AT cobra DOT cs DOT Virginia DOT EDU) wrote: > : Your were given a bad mnemonic: "setc" is actually "stc". > : > : asm volatile("clc"); /* clears (sets to 0) the carry flag */ > : asm volatile("cmc"); /* complements (inverts) the carry flag */ > : asm volatile("stc"); /* sets (to 1) the carry flag */ > > Ahh! Thanks! > > Perhaps somebody can inform me on the difference (if there is one) > between "cmpl $1, %eax" and "testl $1, %eax". It sounds to me like > they do the same thing, so I think I'm missing something... `cmp' does a `sub' without storing the result. `test' does a `and' without storing the result. In effect, `cmp' compares the whole of the operands, while `test' just checks whether any of the bits set in the first operand are also set in the second. -- George