ASH Instruction

Purpose:To perform arithmetic bit shifts on Integers
Format:opcode cnt.rb, src.rx, dst.wx
Operation:dst <- src shifted cnt bits;
Condition
Codes:
N <- dst LSS 0;
Z <- dst EQL 0;
V <- Integer Overflow;
C <- 0;
Exceptions:Integer Overflow
Opcodes:
78ASHLArithmetic shift Long
79ASHQArithmetic shift Quad
Description: The source operand is arithmetically shifted by the number of bits specified by the count operand. The destination is replaced by the result. The source and count operands are unaffected.

A positive count shifts to the left, bringing in 0's into the least significant bit.

A negative count shifts right, bringing in copies of the original sign bit into the most significant bit.

A 0 count copies the source to the destination. ie ASHx #0, R0, R2 becomes MOVx R0, R2

Notes:
1.
Integer overflow occurs on a left shift if any bits shifted into the sign bit differs from the sign bit of the source operand. On overflow, the destination operand is replaced by the low order bits of the true result.
2.
If the count operand is less than -31 (ASHL) or -63 (ASHQ); all the bits of the destination operand are copies of the sign bit of the source operand.
3.
If the count operand is greater than 32 (ASHL) or 64 (ASHQ); the destination operand is replaced by 0.