MSP430 CMP operator

Posted by Ludicrous on Stack Overflow See other posts from Stack Overflow or by Ludicrous
Published on 2014-08-20T17:41:51Z Indexed on 2014/08/20 22:20 UTC
Read the original article Hit count: 326

Filed under:
|

Let's say I have the MSP430 assembly segment below:

r15:

439c

Memory map:

4390:   6045 0200 9c43 6400 8844 5044 363a 0000

Code:

448a:  cmp  #0x363a, 0x0(r15)
4490:  jnz  $+0x1c
4492:  Code continues
.
.
.
44ac: Jump to location

The goal is to have the Z flag high. To do this with a cmp, both src and dst must be equal. If I have 363a in the memory location of r15, why is it that the resulting cmp does not trigger the Z flag?

Through experimentation, I found that putting 3a36 in the memory location of r15 did in fact trigger the Z flag, but I don't understand why.

If anyone could bring this to light, I would greatly appreciate it.

If more information is needed, I will gladly provide it.

© Stack Overflow or respective owner

Related posts about assembly

Related posts about msp430