David Empson wrote:
The 6502's carry flag is "backwards" for a subtract: CLC, SBC will subtract one more, while SEC, SBC will not. This also affects the logic of compare-and-branch sequences: BCC is "branch if less than" (unsigned) on a 6502, but it is "branch if greater than or equal" on other processors.
I see it as *more* consistent, in that Carry = NOT Borrow. In the hardware, it means that SBC need only 1's complement its operand and add, since the carry being set will add 1 for the 2's complement. -michael NadaNet networking for Apple II computers! Home page: http://members.aol.com/MJMahon/ "The wastebasket is our most important design tool--and it's seriously underused."