# `negx`

[M68K Documentation](https://asm-editor.specy.app/documentation/m68k.md) › [Instructions](https://asm-editor.specy.app/documentation/m68k/instruction.md)

Web page: https://asm-editor.specy.app/documentation/m68k/instruction/negx

**Negate with extend**

Category: Arithmetic

Replaces the destination with zero minus its value minus X, at the instruction’s size.

Sizes .b .w .l, .w by default

## Flags

| Flag | Effect |
| --- | --- |
| X | depends on the result |
| N | depends on the result |
| Z | depends on the result |
| V | depends on the result |
| C | depends on the result |

Reads: X

## Forms

- `negx <ea>`
  - Operand: Dn, (An), (An)+, -(An), d(An), d(An,Xn), abs (data alterable)

## Operands

- [`<ea>`](https://asm-editor.specy.app/documentation/m68k/addressing-mode.md): An operand using one of the addressing modes listed for this form. The list determines whether it can be a register, memory or an immediate value. With `opt p=68020`, an allowed `d(An,Xn)` or `d(PC,Xn)` mode also permits the corresponding 68020 indexed and memory indirect forms. See [68020 addressing](https://asm-editor.specy.app/documentation/m68k/addressing-mode/68020.md).

## Description

To negate a value split into several parts, process the least significant part first so X carries a borrow into the next part.

Z is cumulative: a zero result preserves its previous value, and a nonzero result clears it. Set Z and clear X before the first part, for example with `move.w #4, ccr`. Z then remains set only if the whole result is zero.
