68HC05 Instruction Set — Part 4
ASL arithmetically shift a memory location left by one bit ASLA arithmetically shift the accumulator left by one bit ASLX arithmetically shift the index register left by one bit ASR arithmetically shift a memory location right by one bit ASRA arithmetically shift the accumulator right by one bit ASRX arithmetically shift the index register right by one bit LSL logically shift a memory location left by one bit LSLA logically shift the accumulator left by one bit LSLX logically shift the index register left by one bit LSR logically shift a memory location right by one bit LSRA logically shift the accumulator right by one bit LSRX logically shift the index register right by one bit
Notes:
These instructions allow left and right shifts of memory locations, the accumulator, and the index register.
Arithmetic shift left and logical shift left are the same operation, and the ASL, ASLA, and ASLX opcodes are the same as those for LSL, LSLA, and LSLX. In either case, the operand is shifted one bit to the left, with the MSB moving into the condition code register carry (C) bit and a zero moving into the LSB.
Assemblers for the 68HC05 will recognize both the arithmetic shift left and logical shift left instructions and assemble them to the same opcodes.
Arithmetic shift right and logical shift right are two different operations. In both cases, though, the operand is shifted one bit to the right, with the LSB moving into the carry bit.
When an operand is arithmetically shifted right, the MSB remains unchanged. This preserves the sign of the operand. The arithmetic right shift of $80 (-128 in decimal), for example, is $C0 (-64 in decimal).
The MSB of an operand logically shifted right is always set to zero.