115. Subtract Binary Coded Decimal with extend

115.1. Name

SBCD -- Subtract binary coded decimal with extend

115.2. Synopsis

        SBCD        Dy,Dx
        SBCD        -(Ay),-(Ax)

        Size = (Byte)

115.3. Function

Subtracts the source operand to the destination operand along with the extend bit, and stores the result in the destination location. The subtraction is performed using binary coded decimal arithmetic.

The operands, which are packed BCD numbers, can be addressed in two different ways:

  • Data register to data register: The operands are contained in the data registers specified in the instruction.

  • Memory to memory: The operands are addressed with the predecrement addressing mode using the address registers specified in the instruction.

Normally the Z condition code bit is set via programming before the start of an operation. That allows successful tests for zero results upon completion of multiple-precision operations.

115.4. Format

        -----------------------------------------------------------------
        |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
        |---|---|---|---|-----------|---|---|---|---|---|---|-----------|
        | 1 | 0 | 0 | 0 |Ry REGISTER| 1 | 0 | 0 | 0 | 0 |R/M|Rx REGISTER|
        -----------------------------------------------------------------

        Ry specifies destination register.
        Rx specifies source register.
        If R/M = 0: Rx and Ry are data registers.
        If R/M = 1: Rx and Ry are address registers used  for the pre-
        decrementing.

115.5. Result

        X - Set the same as the carry bit.
        N - Undefined
        Z - Cleared if the result is non-zero. Unchanged otherwise.
        V - Undefined
        C - Set if a decimal carry was generated. Cleared otherwise.

115.6. See also

SUB ADDI ADDQ ADDX ADD SUBI SUBQ ABCD SUBX