I have been having a bit of trouble fully understanding the status of the carry flag before and after subtracting.
Let me state what I know already:
The overflow status is set when the results aren't in this range:
The Carry status is set when the result is greater than 127, but what happens when a subtraction result is less than -128. My guess is that it would be clear, but could someone please point me in the right direction.
Stated another way:
Let me state what I know already:
The overflow status is set when the results aren't in this range:
Code:
-128 <= x <= 127
which is easy to test for if variables wider than 8 bits are used to emulate the result.The Carry status is set when the result is greater than 127, but what happens when a subtraction result is less than -128. My guess is that it would be clear, but could someone please point me in the right direction.
Stated another way:
Code:
Carry Result:
__SBC__ __ADC__
in range | 0 | 1 |
out of range | ? | ? |
------- -------
__SBC__ __ADC__
in range | 0 | 1 |
out of range | ? | ? |
------- -------