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

Re: How complex is the 6502?



In article <jpenne.753269520@ee.ualberta.ca> jpenne@ee.ualberta.ca (Jerry Penner) writes:
> dempson@swell.actrix.gen.nz (David Empson) writes:
> 
> >[upside-down carry flag for subtract]
> 
> 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.

So that means the 6502's ALU must have two alternative inputs for the
second operand: one which presents the true value, and the other which
presents the inverted value.  (It doesn't do the complement operation
as a separate step, because it doesn't need an extra clock cycle to
subtract instead of add).

This means a set of eight inverters with tri-state outputs, I suppose.
-- 
David Empson                                                               
dempson@swell.actrix.gen.nz                                                
Snail mail: P.O. Box 27-103, Wellington, New Zealand