I\'m more than half way through learning assembly and I\'m familiar with the concept of how signed and unsigned integers are presented in bits, I know that it might seem a w
At binary level, there is only one addition operation:
0101 + (5)
1010 = (unsigned 10 or signed -6)
--------
1111 (unsigned 15 or signed -1)
What about the carry and overflow flags, they are both set according to a simple rules. CF can be used to detect an oveflow iff we consider that the operands were unsigned, and OF to detect the oveflow iff we consider both of them signed. Both these flags are set according to the result, and it's up to you to decide which of them to use.
The actual formula for OF flag is
OF = CF xor MSB_of_result.
This means that if we are adding two positive numbers (that we consider signed), then if the result is negative, then it oveflowed.