AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
Syntax:          CMP {<cond>} {<P>} <operand1>, <operand2>
Operation:     Reflect result of operand one - operand two
Flags:          N,Z,C,V

This is a very important instruction connected with conditional instruction execution. The instruction compares two operands, and alters the status flags depending on the result.

The result of the operation is not stored anywhere, which explains why there is no need for a destination field. The only thing to remember is that the various subsequent condition codes refer to operand one compared with operand two. Thus, the LT (less than) suffix will execute if operand one is less than operand two.

Example:
CMP    R0,R1          ; Compare R0 with R1
SWIEQ  "OS_NewLine"     ; If (R0 - R1 = 0) execute SWI command

Since the purpose of the CMP instruction is to affect the status flags, the S suffix does not have to be used.

[sh-index] Back to list of manuals