-1
$\begingroup$

Consider addition of two numbers when CPU uses $2's$ complement form: $$ 1\ 1\ 0\ 0\ 0\ 0\ 1\ 1\\0\ 1\ 0\ 0\ 1\ 1\ 0\ 0\\-------\\0\ 0\ 0\ 0\ 1\ 1\ 1\ 1\\------- $$

$$Carry\ = 1,\ Overflow = 0, \ Zero Flag = 0$$

My Reasoning:

  • Zero Flag isn't set because the result isn't zero
  • Overflow isn't set because Carry in = Carry out

However, the answer says that Zero Flag is set $(ZF = 1)$, Am I going wrong ?


Note:

  • Got ZF/Carry/Overflow info from Here
$\endgroup$
1
  • $\begingroup$ Your question already includes a complete answer to the original problem but no question about this answer. Thus, only "yes/no" answers may remain, helping neither you nor future visitors. Please read related meta discussions here and here and adjust your question accordingly, e.g. by formulating a specific question about a single element of your answer you are uncertain about. If you just want general feedback, you are welcome to visit us in Computer Science Chat. $\endgroup$ – Raphael Feb 28 '15 at 16:27
0
$\begingroup$

However, the answer says that Zero Flag is set (ZF=1), Am I going wrong ?

No, you are correct. If the result is not zero, and in this case it is not, the zero flag is not set.

$\endgroup$
1
  • $\begingroup$ Yeah, I too felt the same $\endgroup$ – SimpleGuy Dec 30 '14 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.