SRA Rotate bits right with Carry
Rotate bits right with carry, bit 7 remains unchanged
An arithmetic shift right 1 bit position is performed on the contents of operand. The contents of bit 0 are copied to the Carry flag and the previous contents of bit 7 remain unchanged.
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
---|---|---|---|---|---|---|---|---|
SRA r | ||||||||
1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | CB |
0 | 0 | 1 | 0 | 1 | r | |||
SRA (HL) | ||||||||
1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | CB |
0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 2E |
SRA (IX+d) | ||||||||
1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | DD |
1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | CB |
d | ||||||||
0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 2E |
SRA (IY+d) | ||||||||
1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | FD |
1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | CB |
d | ||||||||
0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 2E |
Register | r |
---|---|
B | 000 |
C | 001 |
D | 010 |
E | 011 |
H | 100 |
L | 101 |
A | 111 |
Flags Affected
Flags |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
s | set if result negative | ||||||||
z | set if result is 0 | ||||||||
h | reset | ||||||||
p/v | set if parity even, reset if parity odd | ||||||||
c | data from bit 0 of source register |
Opcode Matrix
A | B | C | D | E | H | L | (HL) | (IX+d) | (IY+d) | |
---|---|---|---|---|---|---|---|---|---|---|
SRA |
SRA A
CB2F28 |
SRA B
CB2828 |
SRA C
CB2928 |
SRA D
CB2A28 |
SRA E
CB2B28 |
SRA H
CB2C28 |
SRA L
CB2D28 |
SRA (HL)
CB2E215 |
SRA (IX+d)
DDCBnn2E423 |
SRA (IY+d)
FDCBnn2E423 |
Instruction
Opcode hexSize bytesCycle count
| Register | Memory |
Last modified November 16, 2021: Add flags to rot operations (2eee171)