SAR Shift Arithmetic Right - This is a new instruction that does not shift
the sign bit (i.e. the msb) of its operand. The other bits are shifted
as normal except that the new bits that enter from the left are copies
of the sign bit (that is, if the sign bit is 1, the new bits are also 1).
Thus, if a byte is shifted with this instruction, only the lower 7 bits
are shifted. As for the other shifts, the last bit shifted out is stored in
the carry flag.
Code:
mov ax, 0C123H
sal ax, 1 ; ax = 8246H, CF = 1
sal ax, 1 ; ax = 048CH, CF = 1
sar ax, 2 ; ax = 0123H, CF = 0