# `nbcd`

[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/nbcd

**Negate decimal with extend**

Category: Arithmetic

Subtracts the packed decimal byte and X from zero and stores the packed decimal result in the operand.

Size .b

## Flags

| Flag | Effect |
| --- | --- |
| X | depends on the result |
| N | undefined (do not rely on it) |
| Z | depends on the result |
| V | undefined (do not rely on it) |
| C | depends on the result |

Reads: X

## Forms

- `nbcd <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

Each half of the byte holds one decimal digit. To negate a decimal number stored in several bytes, process its least significant pair of digits first. C and X carry a borrow into the next byte.

Set Z and clear X before the first byte, for example with `move.w #4, ccr`. Each zero result preserves Z, and each nonzero result clears it, so the final Z tests the whole result.
