EasyManuals Logo

Texas Instruments TMS320C28x User Manual

Texas Instruments TMS320C28x
695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #236 background imageLoading...
Page #236 background image
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

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

Texas Instruments TMS320C28x Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS320C28x
CategoryProcessor
LanguageEnglish

Related product manuals