Robert Newson wrote: > Looking at the 1/-1 column (closest, as I've got 2/-127), I see that N is > set and so branch should be taken. However, N is in fact clear - N,Z are > clear and C,V are set: using 2's complement and adding (I learnt MC > programming on a 6502) you can see this:
> -127 = 1000 0001 -> 1000 0001 > +2 = 0000 0010 -> 1111 1101 [1's complement] > 1 [extra [initial] 1 for 2's complement] > ----------- > 1 0111 1111 > C = 1 : Obvious Obviously it's not that obvious. ;-) It is true that the result of an addition with NEG(op) equals an subtraction with op, but not when it comes to the flags. If you do a direct subtraction you see that at the end there is no carry involved. -127 = 1000 0001 Destination +2 = 0000 0010 Source 0 1111 1110 Carry bits -------------- 0111 1111 Marcel