# What CPU architecture was first to implement 'inverted borrow' carry flag during subtractions?

## Background

In two's complement arithmetics, if one wants to calculate a subtraction having only an adder that calculates

`{cout,result}=full_adder(arg1,arg2,cin)`,

where `cin` and `cout` are incoming and outgoing carries, respectively, the way is to invert the second argument (a subtrahend) and to add extra one to the sum:

`a-b = a + (~b) + 1`

Using the `full_adder()` as defined above, that would be:

`{some_cout,result}=full_adder(a,~b,1)`

The `some_cout` is inverted borrow here: it is one when there were no borrow in ordinary subtraction of `b` from `a` and vice versa.

Next, that extra one could be actually an incoming borrow, which is also inverted: when it is one, a normal subtraction takes place, when it is zero, the result is 1 less:

`{inv_borrowout,result}=full_adder(a,~b,inv_borrowin)`

For those familiar with 6502 that is readily recognizable as the exact way the SBC instruction there works.

In more "conventional" architectures like 68000, Z80 or x86, the carries in subtraction are true borrows, that is, they get inverted before and after the addition with the inverted second argument. Extra inversion usually costs some logic, die space and worse timings.

## Question

The one known member of 'inverted carries' architecture is 6502, the second known to me is ARM.

What CPU architecture was the first to optimize carries during subtraction by leaving them inverted? Were there any other adopters of such approach besides 6502 and ARM?

• From recollection, the 6801 also has the inverted carry. I'd guess the 6502 inherited it from there, and the ARM inherited it from the 6502. Sep 24, 2021 at 14:28
• I would expect that the first machines with carry propagation would have performed two's-complement subtraction by adding the ones' complement of the subtrahend along with an extra carry, and the inverting of the flag to represent "borrow" was a later innovation. Sep 24, 2021 at 15:58
• Please use tags to define the scope of a question. Although you used 6502 and ARM as examples, they are unlikely to be the correct answer to the question ("Which was the first"), so they they do not belong as tags to the question. Sep 24, 2021 at 16:04
• Inverting is not free, but inverting a single bit is pretty cheap. In fact, modern designs often double invert in order to amplify for long wire runs. Sep 24, 2021 at 23:24
• @OmarL I'm failing to confirm that 6801 has inverted carry. According to this bitsavers.org/components/motorola/6801/… its carry is not inverted.
– lvd
Sep 27, 2021 at 12:15