srl
Shift right logical
Shifts a register or memory byte right one bit, copying bit 0 to C and putting zero into bit 7.
Used in
- 8-bit and 16-bit arithmetic, logic and bitsZ80 assembly
- Reverse a string in placeZ80 assembly
- Multiply and divide, with the remainderZ80 assembly
- Even or odd, count the set bits, multiply by eightZ80 assembly
- Binary searchZ80 assembly
- The snake gameZ80 assembly
- Flappy ASMZ80 assembly
SZHP/VNC ●●0●0●
- ● depends on the result
- 0 always 0
Forms
-
Shifts
rright one bit position. Copies bit 0 to the carry flag and puts a zero into bit 7. srl2 bytes15 cyclesShifts (HL) right one bit position. Copies bit 0 to the carry flag and puts a zero into bit 7.
-
Shifts the memory location pointed to by IX plus
ddright one bit position. Copies bit 0 to the carry flag and puts a zero into bit 7.
Undocumented 1 row
Zilog’s manual does not list these forms, but the Z80 runs them.
-
Shifts the memory location pointed to by IX plus
ddright one bit position. Copies bit 0 to the carry flag and puts a zero into bit 7. Also stores the result inr.
Operands
.org 0x8000
ld b, 3
srl b
halt