Hardware Reference
In-Depth Information
A shift/rotate instruction shifts/rotates the operand by 1 bit. The HCS12 has shift instructions
that can operate on accumulators A, B, and D or a memory location. A memory operand must
be specified using the extended or indexed (direct or indirect) addressing modes. A summary of
shift and rotate instructions is shown in Table 2.6.
Logical Shift Instructions
Mnemonic
Function
Operation
lsl <opr>
lsla
lslb
Logical shift left memory
Logical shift left A
Logical shift left B
0
b0
C
b7
0
lsld
Logical shift left D
b7
b7
C
A
b0
B
b0
Logical shift right memory
Logical shift right A
Logical shift right B
lsr <opr>
lsra
lsrb
0
b7
b0
C
0
lsrd
Logical shift right D
b7
b7
A
b0
B
b0
C
Arithmetic Shift Instructions
Mnemonic
Function
Operation
asl <opr>
asla
aslb
Arithmetic shift left memory
Arithmetic shift left A
Arithmetic shift left B
0
C
b7
b0
Arithmetic shift left D
asld
0
b7
b7
C
A
b0
B
b0
Arithmetic shift right memory
Arithmetic shift right A
Arithmetic shift right B
asr <opr>
asra
asrb
b7
b0
C
Rotate Instructions
Mnemonic
Function
Operation
rol <opr>
rola
rolb
Rotate left memory thru carry
Rotate left A through carry
Rotate left B through carry
b0
C
b7
ror <opr>
rora
rorb
Rotate right memory thru carry
Rotate right A through carry
Rotate right B through carry
b7
b0
C
Table 2.6 Summary of shift and rotate instructions
 
Search WWH ::




Custom Search