delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/19/10:16:39

Message-Id: <199903191515.KAA24423@delorie.com>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: "George Foot" <george DOT foot AT merton DOT ox DOT ac DOT uk>
To: ams AT ludd DOT luth DOT se (Martin Str|mberg)
Date: Fri, 19 Mar 1999 15:12:55 +0000
MIME-Version: 1.0
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

- Raw text -


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