If one performs a two's complement on the operand being subtracted and add it to the operand being subtracted from, the carry flag is inverted for a borrow just as it is using SUBWF. This suggests to me, that internally, SUBWF passes the operand through a two's complement unit and then through an adder. They are probably saving hardware by not conditioning the resulting carry for a subtract operation. Of course I may be WWAAYYY off! After all, I am only an amateur engineer ! Dan On Thu, 30 Sep 1999 21:05:18 +0200, Quentin wrote: >Robin Abbott wrote: >> >> Yes this is quite hard. >Indeed, this was the most confusing part when I learned PIC's. >> X!=Y Z=1 > Z=0? >> Hope this helps! (Mind you it would have been easier if Microchip had simply >> put the logic in Hardware to "correct" the carry flag after a subtraction ! >> >The way I remember the "incorrect" carry bit, is I tell myself that when >I do subtraction, Carry is already set incase I need it, so it clears >when I use it, but stay there if I don't. > >A bit of reverse logic. >:) >Quentin >