68000 Assembly Language - CMPI.B -
What is the content of CCR and D3 after the sequence of following commands? Calculate by hand and show off your work. MOVE.B # 7, D3 CMPI.B # 11, D3 I know that the content of the D3 register will remain unchanged, I do not know how to calculate the CCR Flags
Can you tell me how you did it and which flags were closed and why I really have a hard time understanding it.
D3 CMPI , But surely its less byte will be MOVE due to 7 . (Thanks to @Windand to indicate this.)
The directive set reference will tell you that CMPI works by subtracting operands before the second. It also says that the X flag is not affected, and the other results are set as follows:
-
N:7 -11 & lt; 0, thereforeN = 1 -
Z:7-11! = 0, thereforeZ = 0 -
V:7-11 = -4, that number For the signed numbers,V = 0:C:7-11 = -4, Which is outside unsigned numbers,C = 1.
This is the human version for the flag, the CPU actually uses bitrift logic:
-
N: the result of In the supplement represenation of the most important bit 2, the negative number is set to MSB. -
Z: All the result bits are just a bitwordnandZ = 1if all the bits are zero. -
V: This is a difficult one. The result is MSB withV = (- R7) * (- A7) * B7 + R7 * A7 * (- B7),R7,A7 < MSB of two operands means that you have a signed overflow if subtracting a negative number from a positive number gives you a negative number, or if negative number reduces negatively So lets give you positive.C: the last move of subtraction, aka 9V bit.
Comments
Post a Comment