c - When should carry flag be set in assembly language -


I am having trouble with this problem while writing an ARM assembly simulator in C. I have found some similar questions in the forum, but none of them tells me how to use the carry flag to relate between the two operands and the result.

Any answer is appreciated. thank you in advanced.

You have to check the reference manual for the processor to know who Instructions showed the flag and in what way. I do not have enough information about ARM, but I have seen some changes in other processors:

  • Some instructions that logically generate a layer, do not set the layer flag

  • Some instructions may use the layer flag as some additional underlying operation, or as a result of any connection without extra / subtraction

  • After a subtraction, processor separately C in which the carry flag is set (i.e. some do it in the same way as inversion after the addition of the second operand, others set it to decline).

If you want what you want, then there is a way to see that one should be ready to move one for the joint, it has two modes (the first definition is straightforward, the rap around the behavior of the second realization Comes from):

  unsolicited Expressed w1, w2, result; En le; Lay = w1 & gt; UINT_MAX-W2; Results = w1 + w2; Move = results & lt; W1;  

Comments