<<< Overflow Condition, Cont | Index | INC and DEC Instructions >>> |
Computers don't know the difference between signed and unsigned binary numbers.
This is a good thing, because it makes logic circuits fast.
This is also a bad thing, because distinguishing between signed and unsigned becomes programmer's responsibility.
Distinction between signed and unsigned data types is very important when detecting an overflow after addition or subtraction.
Correct approach to detect the overflow is to consider two separate cases:
Overflow when adding signed numbers is indicated by the overflow flag, OF.
Overflow when adding unsigned numbers is indicated by the carry flag, CF.
<<< Overflow Condition, Cont | Index | INC and DEC Instructions >>> |