MSP430 cmp.b 指令有什么作用?

What does the MSP430 cmp.b instruction do?

致力于应对微腐败挑战。来自 MIPS 的一点经验,我仍在弄清楚一些 msp430 的东西。

指令集摘要没有对 cmp.b 指令进行特别描述的条目,但我可以看到它在这里与 jne 指令一起使用。 jne描述:如果零位被重置则跳转到标签。

455a:  f290 8500 1024 cmp.b #0x85, &0x2410
4560:  0720           jne   #0x4570 <login+0x50>

所以 cmp.b 正在比较 0x85 立即数的字节(如 .b 后缀所示)与存储在地址 0x2410 中的任何字节值,但我只能想象这会设置一点在某个为jne指令(前面提到的零位)预留的寄存器中检查是否应该执行跳转?如果是这种情况,那应该是哪个寄存器?

用户指南说:

Description
The source operand is subtracted from the destination operand. This is accomplished by adding the 1s complement of the source operand plus 1. The two operands are not affected and the result is not stored; only the status bits are affected.

Status Bits
N: Set if result is negative, reset if positive (src ≥ dst)
Z: Set if result is zero, reset otherwise (src = dst)
C: Set if there is a carry from the MSB of the result, reset otherwise
V: Set if an arithmetic overflow occurs, otherwise reset

状态位存储在状态寄存器中,称为SRR2(如果您需要访问它(这里不是这种情况))。

JNE的意思是"jump if not equal",所以所有这些细节对于理解它都无关紧要。

由于信誉不佳,我无法对其他用户的回答发表评论,但我认为以下有关 JNE 命令的信息可能对其他用户对 的评论有用。

JNE/JNZ 是使控制器 在未设置零位 时跳转到给定标签的指令。在这种情况下,控制器将跳转到#0x4570

这在 slau144j MSP430x2xx 系列用户指南 p. 中有描述。 59.