News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

difference between carry flag and overflow flag

Started by Vineel Kumar Reddy Kovvuri, May 16, 2007, 06:38:39 PM

Previous topic - Next topic

Vineel Kumar Reddy Kovvuri



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











dsouza123

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.