CMP AX, loc16
6-74
CMP AX, loc16
Compare
SYNTAX OPTIONS
OPCODE
OBJMODE
RPT
CYC
CMP AX, loc16
0101 010A LLLL LLLL
X
−
1
Operands
AX
Accumulator high (AH) or accumulator low (AL) register
loc16
Addressing mode (see Chapter 5)
Description
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]);
Flags
and
Modes
N
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.
Z
The comparison is tested for a zero condition. The zero flag bit is set if the
operation ( AX
−
[loc16] ) = 0, otherwise it is cleared.
C
If the subtraction generates a borrow, then C is cleared; otherwise C is set.
Repeat
This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only once.
Example
; Branch if VarA is higher then VarB:
MOV AL,@VarA
; Load AL with contents of VarA
CMPB AL,@VarB
; Set Flags On (AL − VarB)
SB Dest,HI
; Branch if VarA higher then VarB
Содержание TMS320C28x
Страница 30: ...1 12...
Страница 80: ...This page intentionally left blank 2 50 This page intentionally left blank...
Страница 269: ...IN loc16 PA 6 112 MOV AL 0 AL 0 UOUT IORegC AL IOspace IORegC AL 10...
Страница 308: ...MAXCUL P loc32 6 151 Saturate MOVL Var64 2 ACC Store result into Var64 MOVL Var64 P...
Страница 509: ...SUBL ACC P PM 6 352 SUBL ACC P PM ACC S B 11 M X 4 MOVH Y ACC 5 Store Q15 result into Y...
Страница 585: ...This page intentionally left blank 7 32 This page intentionally left blank...