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

Re: How complex is the 6502?



dempson@swell.actrix.gen.nz (David Empson) writes:

>You might need to do something unusual to cope with the 6502's
>upside-down carry flag in subtraction.  I don't have a full TTL data
>book handy (only pinout diagrams), so I don't know what the 74381 can
>do (all my sheet says is "8 functions").

It's not really upside down.  Basically, the add instruction is used
to do the subtract instruction.  The 6502 just inverts the bits in
the operand before it feeds them to the adder.  So that's why you set
the carry for subtract.  Accumulator + OPERAND' + Carry=1 (the tick
means inverted) is the same as Accumulator - OPERAND.  If you don't
set the carry, it's just like adding the accumulator to the one's
complement of the Operand, when you really want the two's complement.
-- 
Jerry Penner   jpenne@ee.ualberta.ca   or   jjp@myrias.ab.ca