Re: 6502 flag behavior (was re: xu1541)

From: Nate Lawson <>
Date: Thu, 31 May 2012 17:07:16 -0700
Message-Id: <>
On May 31, 2012, at 12:15 PM, Spiro Trikaliotis wrote:

> * On Thu, May 31, 2012 at 09:39:13AM +0300 Marko Mäkelä wrote:
>> One wrong thing about the x86 is that it expects and sets the Carry
>> flag in the wrong way in SBC operations (subtract with carry). I
>> find the 6502 more logical.
> Technically, you are right, as the behaviour of the 6502 is exactly what
> you get when you do the calculations by hand.
> Practically, (almost?) all other CPUs of that time used the carry as
> carry/borrow. That is, for subtractions, carry in and carry out were
> inverted. It seems people felt better this way, although it is further
> away from what the hardware actually does.
> I believe the 6502 did not behave this way because MOS did not want to
> spare one (or two) XOR for the carry, to make the chip cheaper. The
> result is that users of 6502 machines know better what is goinig on
> inside the machien - the same way as C64 users were forced to lean more
> about the machine in order to use graphics and sound, because the BASIC
> was so limited.

I wonder if it's another reason. Remember the company started with calculators, and Chuck Peddle experimented with cash registers at GE. Decimal arithmetic was a key feature, so much so that it was one of the main patents on the 6502 instruction set.

Is this behavior more consistent with industrial control or decimal arithmetic operations?


       Message was sent through the cbm-hackers mailing list
Received on 2012-06-01 01:00:05

Archive generated by hypermail 2.2.0.