On Sun, Apr 10, 2016 at 1:17 PM, Ken Pettit <[email protected]> wrote:

> A = 0xFF
> Carry = Set
> Undocumented overflow:  ??
>
> Ken
>
>
OK. Just trying to figure out the ins and outs.

-128 = 0b1000_0000
subtracting that value from itself is adding it's 2's complement, which
happens to be identical.
And since carry is true, that's like adding -1 = 0b1111_1111
= 0b1000_0000  + 0b1000_0000 + 0b1111_1111

= 0b1111_1111 with a carry-out.

But as I understand it when carry is a "borrow" it is complemented (it's a
subtraction instruction so it's a borrow)?

So I think the final CF should be false based on that? But you got the same
answer, true, the GNUSim8085 does. Just not sure how that works.

Undocumented overflow (the V flag) I would think would be unset since the
final result is a correct result in 8 bits.

-- John.

Reply via email to