<< Previous | Next >>

> SRA b,BCDE
> SRA b,JKHL Shift Right Arithmetical Rabbit 4000 Instruction

> Opcode | Instruction | Clocks | Operation
> ---- | SRA b,BCDE | 4 (2,2) | BCDE = {B[7],BCDE[31,1]} CF = E[0] b = b - 1 repeat while b != 0
> DD 98 | SRA 1,BCDE | 4 (2,2) | repeat the operation 1 time
> DD 99 | SRA 2,BCDE | 4 (2,2) | repeat the operation 2 times
> DD 9B | SRA 4,BCDE | 4 (2,2) | repeat the operation 4 times
> ---- | SRA b,JKHL | 4 (2,2) | JKHL = {J[7],JKHL[31,1]} CF = L[0] b = b - 1 repeat while b != 0
> FD 98 | SRA 1,JKHL | 4 (2,2) | repeat the operation 1 time
> FD 99 | SRA 2,JKHL | 4 (2,2) | repeat the operation 2 times
> FD 9B | SRA 4,JKHL | 4 (2,2) | repeat the operation 4 times

> Flags | ALTD | IOI/IOE
> S | Z | L/V | C | F | R | SP | S | D
> · | · | L | · | · | · |  |  |

> #### Description

> Arithmetically shifts to the right the bits of the data in register BCDE or JKHL. Bits 1 through 31 are each shifted to the next lowest-order bit position. The highest-order bit of BCDE or JKHL is shifted into itself and the lowest-order bit is shifted to the C flag. See the figure below.

> Figure 21: The bit logic of the SRA instruction.

> The instruction repeats the number of times specified by `b` which can be 1, 2 or 4.

<< Previous | Next >>