"mov #10,r5\n"
"sub #1,r5\n" //test value
I run in hardware, when 'sub' exec, the Carry flag is set. why?
CodePudding user response:
When it comes to subtraction, the carry flag is reversed compared to addition. If the value wraps around, carry is set to 0. If it doesn't (as in your example) it is set to 1.
Unfortunately, this is not 100% clear when reading the processor manual. However, this behavior is consistent with other processors, e.g. 6502.