CMPB AX, #8bit
SYNTAX OPTIONS
CMPB AX, #8bit
Operands
AX
#8bit
Description
Flags
N
and
Modes
Z
C
Repeat
Example
; Check if VarA is within range 0x80 <= VarA <= 0xF0:
MOV
AL,@VarA
CMPB
SB
OutOfRange,GT
CMPB
SB
OutOfRange,LT
Accumulator high (AH) or accumulator low (AL) register
8-bit immediate constant value
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);
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.
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.
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,#0xF0
AL,#0x80
OPCODE
0101 001A CCCC CCCC
; Load AL with contents of VarA
; Set Flags On (AL − 0x00F0)
; Branch if VarA greater then 0x00FF
; Set Flags On (AL − 0x0080)
; Branch if VarA less then 0x0080
CMPB AX, #8bit
Compare 8-bit Value
OBJMODE
RPT
CYC
X
−
1
6-79
Need help?
Do you have a question about the TMS320C28x and is the answer not in the manual?