ext

Sign-extend

Extends the sign of the operand, depending on the specified size.

Sizes .w .l, .w by default

Used in
XNZVC –●●00
  • ● set from the result
  • 0 always 0
  • – not changed

Forms

  • ext

Operands

Dn
A data register, d0 to d7. More

If the part to extend is negative, it will be filled with 1s, otherwise it will be filled with 0s. Defaults to word

* --- Byte to word: sign-extends byte in low word ---
move.l #$0000007F, d0
ext.w d0 ; d0 = $0000007F (positive, no change)

move.l #$000000FF, d1
ext.w d1 ; d1 = $0000FFFF (-1 sign-extended)

* --- Word to long: sign-extends word ---
move.l #$00008000, d2
ext.l d2 ; d2 = $FFFF8000