MAX AX, loc16
6-149
MAX AX, loc16
Find the Maximum
SYNTAX OPTIONS
OPCODE
OBJMODE
RPT
CYC
MAX AX, loc16
0101 0110 0111 001A
0000 0000 LLLL LLLL
1
Y
N+1
Operands
AX
Accumulator high (AH) or accumulator low (AL) register
loc16
Addressing modes (see Chapter 5)
Description
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;
Flags and
Modes
N
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.
Z
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.
V
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.
Repeat
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.
Example
; Saturate VarA as follows:
; if(VarA > 2000) VarA = 2000;
; if(VarA < −2000) VarA = −2000;
MOV AL,@VarA
; Load AL with contents of VarA
MOV @AH,#2000
; Load AH with the value 2000
MIN AL,@AH
; if(AL > AH) AL = AH
NEG AH
; AH = −2000
MAX AL,@AH
; if(AL < AH) AL = AH
MOV @VarA,AL
; Store result into VarA
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...