John, -----Original Message----- From: John Albers |However, things seem to get weird around 0, assume that W=0, after the following is executed, I think that Carry flag should be zero. (maybe its not, but I would like to know why) | |sublw 15 | |According to the PIC16F84 data sheet, the sublw subtracts by using two complement addition. Therefore 15-0 = 15 + (Two's Complement of 0) = 15 + (b'11111111' + b'1') = 15 + 0 = 15 which should not set the Carry Flag. Carry Flag = 0 is supposed to imply that W > L, but W=0 and L=15 , and 0 is NOT greater than 15. I think You forget the carry bit produced when doing the 2's complement of 0 ! Best Regards, S.-