101. PACK binary coded decimal

101.1. Name

PACK -- Pack binary coded decimal        (68020+)

101.2. Synopsis

        PACK        -(Ax),-(Ay),#<adjustment>
        PACK        Dx,Dy,#<adjustment>

        Size = (Byte, Long)

101.3. Function

Convert byte-per-digit unpacked BCD to packed two-digit- per-byte BCD. When operand is in a data register, 16 bits adjustment is added to source operand (16 bits). Then, bits 8 to 11 and 0 to 3 are packed and placed in the bits 0 to 7 of destination register. Others bits of this register are not altered.

When operand is in memory, there's a research by pre-decrementing of the two bytes placed at given address. The two bytes are linked together, then adjustment is added, and the compacted result is stored at destination's place.

101.4. Format

        -----------------------------------------------------------------
        |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
        |---|---|---|---|-----------|---|---|---|---|---|---|-----------|
        | 1 | 0 | 0 | 0 |   Dy/Ay   | 1 | 0 | 1 | 0 | 0 |R/M|   Dx/Ax   |
        |---------------------------------------------------------------|
        |                    16 BITS ADJUSTMENT                         |
        -----------------------------------------------------------------

        R/M = 0 -> Direct addressing by data register.
        R/M = 1 -> Addressing by pre-decrementing.
        Register Dy/Ay specifies destination register.
        Register Dx/Ax specifies source register.
        "16 BITS ADJUSTMENT" is an immediate value added to source operand.

101.5. Result

        None.

101.6. See also

UNPK