# ROTATE Instructions in 8085

**ROTATE** is a logical operation of the 8085 microprocessor. It is a 1-byte instruction. This instruction does not require any operand after the opcode. It operates the content of the accumulator and the result is also stored in the accumulator. The Rotate instruction is used to rotate the bits of accumulator. **Types of ROTATE Instruction:** There are 4 categories of the ROTATE instruction: Rotate accumulator left (RLC), Rotate accumulator left through carrying (RAL), Rotate accumulator right (RRC), Rotate accumulator right through carry (RAR). Among these four instructions; two are for rotating left and two are for rotating right. All of them are explained briefly in the following sections:

**Rotate accumulator left (RLC) –**In this instruction, each bit is shifted to the adjacent left position. Bit D7 becomes D0. Carry flag CY is modified according to the bit D7. For example:-

A = D7 D6 D5 D4 D3 D2 D1 D0 //before the instruction A = 10101010; CY=0 //after 1st RLC A = 01010101; CY=1 //after 2nd RLC A = 10101010; CY=0

**Rotate accumulator left through carry (RAL) –**In this instruction, each bit is shifted to the adjacent left position. Bit D7 becomes the carry bit and the carry bit is shifted into D0. Carry flag CY is modified according to the bit D7. For example:

A = D7 D6 D5 D4 D3 D2 D1 D0 //before the instruction A = 10101010; CY=0 //after 1st RAL A = 01010100; CY=1 //after 2nd RAL A = 10101001; CY=0

**Rotate accumulator right (RRC) –**In this instruction, each bit is shifted to the adjacent right position. Bit D7 becomes D0. Carry flag CY is modified according to the bit D0. For example:

A = D7 D6 D5 D4 D3 D2 D1 D0 //before the instruction A = 10000001; CY=0 //after 1st RRC A = 11000000; CY=1 //after 2nd RRC A = 01100000; CY=0

**Rotate accumulator right through carry (RAR) –**In this instruction, each bit is shifted to the adjacent right position. Bit D0 becomes the carry bit and the carry bit is shifted into D7. Carry flag CY is modified according to the bit D0. For example:

A = D7 D6 D5 D4 D3 D2 D1 D0 //before the instruction A = 10000001; CY=0 //after 1st RAR A = 01000000; CY=1 //after 2nd RAR A = 10100000; CY=0

**Applications of ROTATE Instructions:** The ROTATE instructions are primarily used in arithmetic multiply and divide operations and for serial data transfer. For example:

If A is 0000 1000 = 08H 1. By rotating 08H right : A = 0000 0100 = 04H This is equivalent todividing by 2. 2. By rotating 08H left : A = 0001 0000 = 10H This is equivalent tomultiplying by 2.

However, these procedures are invalid when logic 1 is rotated left from D7 to D0 or vice versa. For example, if 80H is rotated left it becomes 01H.