【问题标题】:MSP430 JC, JNC , JEQ and JNZMSP430 JC、JNC、JEQ 和 JNZ
【发布时间】:2014-10-15 15:45:20
【问题描述】:
我在查看 MSP430 的指令集时偶然发现了一些我不太理解的东西。我似乎无法区分JC 和JNZ 和JNC 和JEQ 之间的区别。我了解JEQ和JNZ的功能,但我对JC和JNC的用法有点模糊。
我知道JC 和JNC 使用进位标志的事实,但我不确定它的使用方式以及它们与JNZ 和JEQ 有何不同。
【问题讨论】:
标签:
assembly
msp430
instruction-set
【解决方案1】:
JC = Jump if carry set (C=1)
JNC = Jump if carry is not set (C=0)
JZ = Jump if zero-flag is set
JNZ = Jump if zero-flag is not set
JEQ = Jump if equal => another 'name' for JZ
(There are many instruction aliases').
当您添加两个设置了最高位的数字时,您最终会得到比原始数字长一位的结果。这个新的比特“去”携带。它也用作减法中的借用标志。比较与减法相同,只是不存储结果值。
这就是 SBC 对标志所做的:
Status Bits N: Set if result is negative, reset if positive
Z: Set if result is zero, reset otherwise
C: Set if there is a carry from the MSB of the result, reset otherwise.
Set to 1 if no borrow, reset if borrow.
V: Set if an arithmetic overflow occurs, reset otherwise.