shr/sar/rcr
Shift right shifts the accumulator one bit to the right, filling the most significant bit with a 0. Shift arithmetic right works the same except that it preserves the most significant bit. Rotate though carry right also shifts the accumulator one bit to the right but fills the most significant bit with the carry flag.
The three instructions shift the least significant bit into the carry flag.
The other flags are set according to an add
instruction for shl
and an or 0x00
for shr
.
Instruction | Encoding | Semantics | Cycles |
---|---|---|---|
rcr | 00 001 000 | 3 | |
shr | 00 010 000 | 3 | |
sar | 00 011 000 | 3 |
The assembler also defines shl
and rcl
.
However, these are only pseudo-instructions.
shl
is equivalent to add acc, acc
, rcl
to adc acc, acc
.