Texas Instruments TMS320C28x Reference Manual page 231

Dsp cpu and instruction set
Table of Contents

Advertisement

CMP AX, loc16
CMP AX, loc16
SYNTAX OPTIONS
CMP AX, loc16
Operands
AX
loc16
Description
Flags
N
and
Modes
Z
C
Repeat
Example
; Branch if VarA is higher then VarB:
MOV
CMPB
SB
6-74
Accumulator high (AH) or accumulator low (AL) register
Addressing mode (see Chapter 5)
The content of the specified AX register (AH or AL) is compared with the 16-bit
content of the location pointed to by the "loc16" addressing mode. The result
of (AX−- [loc16] ) is evaluated and the status flag bits set accordingly. The AX
register and content of the location pointed to by "loc16" are left unchanged:
Set Flags On (AX − [loc16]);
If the result of the operation is negative, then N is set; otherwise it is cleared.
The CMP instruction assumes infinite precision when it determines the sign of
the result. For example, consider the subtraction 0x8000 − 0x0001. If the
precision were limited to 16 bits, the result would cause an overflow to the
positive number 0x7FFF and N would be cleared. However, because the CMP
instruction assumes infinite precision, it would set N to indicate that
0x8000 − 0x0001 actually results in a negative number.
The comparison is tested for a zero condition. The zero flag bit is set if the
operation ( AX − [loc16] ) = 0, otherwise it is cleared.
If the subtraction generates a borrow, then C is cleared; otherwise C is set.
This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only once.
AL,@VarA
AL,@VarB
Dest,HI
OPCODE
0101 010A LLLL LLLL
; Load AL with contents of VarA
; Set Flags On (AL − VarB)
; Branch if VarA higher then VarB
Compare
OBJMODE
RPT
CYC
X
1

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C28x and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF