MAX AX, loc16
SYNTAX OPTIONS
MAX AX, loc16
Operands
AX
loc16
Description
Flags and
N
Modes
Z
V
Repeat
Example
; Saturate VarA as follows:
; if(VarA > 2000) VarA = 2000;
; if(VarA < −2000) VarA = −2000;
MOV
AL,@VarA
MOV
@AH,#2000
MIN
AL,@AH
NEG
AH
MAX
AL,@AH
MOV
@VarA,AL
0101 0110 0111 001A
0000 0000 LLLL LLLL
Accumulator high (AH) or accumulator low (AL) register
Addressing modes (see Chapter 5)
Compare the signed contents of the specified AX register (AH or AL) with the
signed content of the location pointed to by the "loc16" addressing mode and
load the AX register with the larger of these two values:
if(AX < [loc16]), AX = [loc16];
if(AX >= [loc16]), AX = unchanged;
If AX is less then the contents of the addressed location (AX < [loc16]) then
the negative flag bit will be set; otherwise, it will be cleared.
If AX and the contents of the addressed location are equal (AX = [loc16]) then
the zero flag bit will be set; otherwise, it will be cleared.
If AX is less then the contents of the addressed location (AX < [loc16]) then
the overflow flag bit will be set. This instruction cannot clear the V flag.
If the operation is follows a RPT instruction, the instruction will be executed
N+1 times. The state of the N, Z, and V flags will reflect the final result.
OPCODE
OBJMODE
; Load AL with contents of VarA
; Load AH with the value 2000
; if(AL > AH) AL = AH
; AH = −2000
; if(AL < AH) AL = AH
; Store result into VarA
MAX AX, loc16
Find the Maximum
RPT
CYC
1
Y
N+1
6-149
Need help?
Do you have a question about the TMS320C28x and is the answer not in the manual?