NEG

NEGATENEG

Operation:

(EA) +- SRC - (EA)

(EA) +- (EA) + 1 (affecting flags)

Description:

NEG destination

NEG (Negate) subtracts the destination operand, which may be a byte or a word, from oand returns the result to the destination. This forms the two's complement of the number, effectively reversing the sign of an integer. If the operand is zero, its sign is not changed.

Flags Affected:

AF, CF, OF, PF, SF, ZF

Attempting to negate a byte containing -128 or a word containing -32,768 causes no change to the operand and sets OF. NEG updates AF, CF, OF, PF, SF and ZF. CF is always set except when the operand is zero, in which case it is cleared.

Encoding:

11111 011 w 1mod a11 rIm 1

if w = athen SRC = FFH else SRC = FFFFH

NEG Operands

Clocks·

Transfers

Bytes

NEG Coding Example

register

3

-

2

NEGAL

memory

16(24) + EA

2

2-4

NEG MULTIPLIER

*b(w): where b denotes the number of clock cycles for byte operands and w denotes the number of clock cycles for word operands.

2-120

Page 155
Image 155
Intel 210200-002 manual Negateneg, 11111 011 w 1mod a11 rIm, NEG destination