The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Vineel Kumar Reddy Kovvuri on May 16, 2007, 06:38:39 PM

Title: difference between carry flag and overflow flag
Post by: Vineel Kumar Reddy Kovvuri on May 16, 2007, 06:38:39 PM


hi everybody


i am new to assembly . But very much interested in mastering it so plz help me.....

my doubt is when are carry flag , overflow flag  set or unset

i searched the internet . but i didn't understood the difference.
i got totally confused .  :'(

can some one give few examples of setting these flags or unsetting these flags

Please help me

thanks in advance










Title: Re: difference between carry flag and overflow flag
Post by: dsouza123 on May 16, 2007, 11:55:59 PM
The carry flag is used by many instructions.

In unsigned addition and subtraction, add, adc, sub, sbb.
In shifting the carry holds the bit shifted or rotated out, shr, shl, rcr, rcl, ror, rol.
It can also be set stc, cleared clc, toggled cmc.
It can also be used for setting a byte to 0 or 1 setc, setnc.
It can hold the result of bit operations, btc, btr, bts.
Also used by many of the conditional jump instructions jc, jnc and others.

The overflow is used for signed addition and subtraction.
It is affected/used by a few instructions.

The opcodes help file that comes with MASM32
shows what flags are affected/used by an instruction.
Title: Re: difference between carry flag and overflow flag
Post by: Ratch on May 17, 2007, 03:23:28 AM
vineel,

     Already asked, already answered.  Ratch

http://www.masm32.com/board/index.php?topic=6620.0