CMP后会设置进位标志吗?
will carry flag be set after CMP?
(MSP430 16 位)
CLR[.W] R14
CMP[.W] #0x0200, R14
JC #1234
我怎么知道是否会设置进位标志?
可以CMP[.W] #0x0200, R14
设置进位标志吗?
看看文档会有帮助。
MSP430x2xx Family User's Guide 的第 3.4.6.14 节说:
Syntax
CMP src,dst
or CMP.W src,dst
Description
The source operand is subtracted from the destination operand. […]
The two operands are not affected and the result is not stored; only the status bits are affected.
Status Bits
[…]
C: Set if there is a carry from the MSB of the result, reset otherwise
因此,如果从零减去 0x200 需要进位,则进位标志将被设置。
进位标志的这个含义在JC/JHS的3.4.6.24节的文档中说得更清楚:
Description
[…] JC (jump if carry/higher or same) is used for the comparison of unsigned numbers (0 to 65536).
Example
R5 is compared to 15. If the content is higher or the same, branch to LABEL.
CMP #15,R5
JHS LABEL ; Jump is taken if R5 >= 15
...... ; Continue here if R5 < 15
(MSP430 16 位)
CLR[.W] R14
CMP[.W] #0x0200, R14
JC #1234
我怎么知道是否会设置进位标志?
可以CMP[.W] #0x0200, R14
设置进位标志吗?
看看文档会有帮助。
MSP430x2xx Family User's Guide 的第 3.4.6.14 节说:
Syntax
CMP src,dst
orCMP.W src,dst
Description
The source operand is subtracted from the destination operand. […] The two operands are not affected and the result is not stored; only the status bits are affected.Status Bits
[…]
C: Set if there is a carry from the MSB of the result, reset otherwise
因此,如果从零减去 0x200 需要进位,则进位标志将被设置。
进位标志的这个含义在JC/JHS的3.4.6.24节的文档中说得更清楚:
Description
[…] JC (jump if carry/higher or same) is used for the comparison of unsigned numbers (0 to 65536).Example
R5 is compared to 15. If the content is higher or the same, branch to LABEL.CMP #15,R5 JHS LABEL ; Jump is taken if R5 >= 15 ...... ; Continue here if R5 < 15