简体   繁体   中英

MSP430 JC, JNC , JEQ and JNZ

I was looking through the MSP430's instruction set and stumbled upon something I can't quite understand. I can't seem to differentiate what the difference between JC and JNZ and JNC and JEQ . I understand the functions of JEQ and JNZ , but I'm a Little fuzzy on the usage of JC and JNC .

I know for a fact JC and JNC utilize the carry flag, but I'm not sure in what way it's used and how they differ from JNZ and JEQ .

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').

When you add two numbers with highest bit set, you'd end up with result with one bit longer that the original numbers. This new bit "goes" to carry. It's also used as borrow-flag in subtractions. Compare is the same as subtraction except that the result value is not stored.

That's what SBC does to the flags:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM