Texas Instruments TMS320C28x Reference Manual page 402

Dsp cpu and instruction set
Table of Contents

Advertisement

NEG AX
SYNTAX OPTIONS
NEG AX
Operands
AX
Description
Flags and
N
Modes
Z
C
V
Repeat
Example
; Take the absolute value of VarA:
MOV
NEG
SB
MOV
NoOverflow:
MOV
Accumulator high (AH) or accumulator low (AL) register
Replace the contents of the specified AX register with the negative of AX:
if(AX = 0x8000)
{
AX = 0x8000;
V flag = 1;
}
else
AX = −AX;
if(AX = 0x0000)
C flag = 1;
else
C flag = 0;
After the operation, if bit 15 of AX is 1, then the negative flag bit is set;
otherwise, it is cleared.
After the operation, if AX is 0, then the Z bit is set, otherwise it is cleared.
If AX is 0, C is set; otherwise, it is cleared.
If AX is 0x8000 at the start of the operation, then this is considered an overflow
and V is set. Otherwise V is not affected.
This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only once.
AL,@VarA
AL
NoOverflow,NOV
@VarA,0x7FFFh
@VarA,AL
OPCODE
1111 1111 0101 110A
; Load AL with contents of VarA
; If Al = 8000h, then V = 1
; Branch and save −AL if no overflow
; Save 7FFF if overflow
; Save NEG AL if no overflow
NEG AX
Negate AX Register
OBJMODE
RPT
CYC
X
1
6-245

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Table of Contents

Save PDF