sbcd

Subtract decimal with extend

Subtracts the source packed decimal byte and X from the destination, storing the packed decimal result there.

Size .b

XNZVC ●?●?●
  • ● depends on the result
  • ? undefined (do not rely on it)
  • Reads X

Forms

  • sbcd ,
  • sbcd ,

Operands

Dn
A data register, d0 to d7. More
-(An)
Decreases an address register by 1, 2 or 4 bytes for a byte, word or long access, then accesses memory there. A byte access through sp decreases it by 2 to keep it even. More

Each byte holds two decimal digits, one in each half. Both operands must be data registers, or both must use predecrement addressing. The registers need not be the same.

For a decimal number stored in several bytes, start with its least significant pair of digits. 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 number.