[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with confirmation on a small bit of assembly?



David Empson wrote:
Michael J. Mahon <mjmahon@aol.com> wrote:


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.


I wasn't suggesting that it was illogical, it is just different from
what someone might be used to on another processor.

It simplifies the 6502's ALU, since it only needs to implement a single
add operation with alternative inputs.

Exactly--and the RISC architect in me *loves* that gate-saving symmetry.
;-)

-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."