CMPB AX, #8bit
6-79
CMPB AX, #8bit
Compare 8-bit Value
SYNTAX OPTIONS
OPCODE
OBJMODE
RPT
CYC
CMPB AX, #8bit
0101 001A CCCC CCCC
X
−
1
Operands
AX
Accumulator high (AH) or accumulator low (AL) register
#8bit
8-bit immediate constant value
Description
Compare the content of the specified AX register (AH or AL) with the
zero-extended 8-bit unsigned immediate constant. The result of (AX
−
0:8bit)
is evaluated and the status flag bits are set accordingly. The content of the AX
register is left unchanged:
Set Flags On (AX − 0:8bit);
Flags
and
Modes
N
If the result of the operation is negative, then N is set; otherwise it is cleared.
The CMPB 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
CMPB 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
−
[0:8bit]) = 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
; Check if VarA is within range 0x80 <= VarA <= 0xF0:
MOV AL,@VarA
; Load AL with contents of VarA
CMPB AL,#0xF0
; Set Flags On (AL − 0x00F0)
SB OutOfRange,GT
; Branch if VarA greater then 0x00FF
CMPB AL,#0x80
; Set Flags On (AL − 0x0080)
SB OutOfRange,LT
; Branch if VarA less then 0x0080
Summary of Contents for TMS320C28x
Page 30: ...1 12...
Page 80: ...This page intentionally left blank 2 50 This page intentionally left blank...
Page 269: ...IN loc16 PA 6 112 MOV AL 0 AL 0 UOUT IORegC AL IOspace IORegC AL 10...
Page 308: ...MAXCUL P loc32 6 151 Saturate MOVL Var64 2 ACC Store result into Var64 MOVL Var64 P...
Page 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...
Page 585: ...This page intentionally left blank 7 32 This page intentionally left blank...