bachra04
asked on
explanation required
I went through the following question / answer :
Assume that AX = BBBBh and BX = BBBBh. What will be the contents
of the AX register after the instruction:
ADD AL,BL
is executed.
A. BBBBh B. BBF6h C. BB76h D. BB78h E. None of these
Answer: C
What will the condition code bits be after the instruction is
executed.
A. SF=0 ZF=0 OF=0 CF=1 B. SF=0 ZF=0 OF=1 CF=1
C. SF=0 ZF=1 OF=0 CF=1 D. SF=1 ZF=0 OF=1 CF=1 E. None of the above
Answer: B
I didn't understand why the OF is set to 1 can someone explain to me that ?
Thanks.
Assume that AX = BBBBh and BX = BBBBh. What will be the contents
of the AX register after the instruction:
ADD AL,BL
is executed.
A. BBBBh B. BBF6h C. BB76h D. BB78h E. None of these
Answer: C
What will the condition code bits be after the instruction is
executed.
A. SF=0 ZF=0 OF=0 CF=1 B. SF=0 ZF=0 OF=1 CF=1
C. SF=0 ZF=1 OF=0 CF=1 D. SF=1 ZF=0 OF=1 CF=1 E. None of the above
Answer: B
I didn't understand why the OF is set to 1 can someone explain to me that ?
Thanks.
ASKER
I understand that :
BBh + BBh caused a carry that's why CF is set ;
But what confuses me is when do we say that there is Overflow; do you mean every time we have a carry we'll have overflow ?
Is there a case when we have overflow and not a carry ? or vice versa ?
Thanks
BBh + BBh caused a carry that's why CF is set ;
But what confuses me is when do we say that there is Overflow; do you mean every time we have a carry we'll have overflow ?
Is there a case when we have overflow and not a carry ? or vice versa ?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can the carry flag be set 1 in a substraction operation :
e.g : sub 11h, 44h
e.g : sub 11h, 44h
>> Can the carry flag be set 1 in a substraction operation :
In the case of a subtraction, the CF is set in case of what is called a borrow :
00000001 - 00000010 = 11111111
In order for this (unsigned) subtraction to work, we need a borrow, to add a 9th 1 bit to the first operand :
100000001 - 00000010 = 11111111
so the CF flag is set.
In the case of a subtraction, the CF is set in case of what is called a borrow :
00000001 - 00000010 = 11111111
In order for this (unsigned) subtraction to work, we need a borrow, to add a 9th 1 bit to the first operand :
100000001 - 00000010 = 11111111
so the CF flag is set.
OF is the overflow flag, and it is set if the previous instruction caused an (arithmetic) overflow.
In this case, ADD AL,BL caused an overflow, so the flag is set.