# NBCD Instruction

The instruction NBCD (Negate BCD) negates a BCD-number. The method used for tens complement. The tens complement to 01 is 99 (1+99=100), to 26 is 74 (26+74=100) and so on. The X flag is added to the tens complement which is the loan from the previous BCD calculation (multi-precision). A normal series of BCD instructions starts with the X flag cleared and the Z flag set.
ADDRESS METHODS: Dn, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l
DATA LENGTH: Byte

FLAGS: | X - Set if a loan was required when subtracting, else cleared
N - undef
Z - Cleared if the result was 0, else unaffected
C - Same as X
V - undef

SYNTAX: NBCD <ea>

EXAMPLE CODE:

NBCD.B D0 Negates the BCD number in D0