The purpose of each shift instruction is to shift an operand, bit by bit, to the right or to the left. Direction of shift (left or right) is dependent upon the specific instruction. The operand to be shifted must first be loaded into the accumulator (or accumulator and accumulator extension, depending upon which shift instruction is to be executed). All shift instructions are in the short format only; there are no long-format shift instructions.

The manner of shifting is dependent upon the specific shift instruction. In shift-left operations, zeros are shifted into low-order vacated positions. For example:

Example of Shift (in this case, shift left) instruction

In shift right operations, bits that are shifted in can be:

  1. Zeros -- a logical shift right (SRA instruction)
  2. The original value of the sign bit (always from bit 0 of the accumulator) -- an arithmetic right shift (SRT instruction)
  3. The bits that are shifted out of the low-order position (bit 15) of the accumulator extension (RTE instruction)

Depending upon the instruction being executed, shift operations can be ended in one or both of two ways:

  1. By a specified count (the shift count) decrementing to zero. (Refer to the individual descriptions for information about where a count is set up before a shift instruction is executed.)
  2. By a bit value of 1 shifting into the high-order position (bit 0) of the accumulator.

Refer to the individual descriptions for information about how a particular shift operation is ended.

But wait, there's MORE...

Valid HTML 4.01 Transitional