I was studying from a web course and found an example in which subtraction operation was explained. In that example,
A= A5H, B= 9BH
and operation SUB B was executed.
As the subtraction operation in 8085 microprocessor is carried out by converting subtrahend into 2's complement and then adding it to minuend, the answer thus obtained was A= (0000 1010)2(see figure)
As it is clearly visible that a carry is produced after the operation, so the CY flag, i.e., carry flag must be SET. But they explained it as under:
"CY bit seems to be ‘1’. But it is complemented and then stored. Therefore, CY bit is stored as ‘0’."
I didn't understand that why carry flag is to be complimented? Is it because the subtrahend is converted into 2's complement or anything else?