# ROTATE Instructions in 8085

**ROTATE** is a logical operation of 8085 microprocessor. It is a 1 byte instruction. This instruction does not require any operand after the opcode. It operates the content of accumulator and the result is also stored in the accumulator. The Rotate instruction is used to rotating the bits of accumulator.

**Types of ROTATE Instruction:**

There are 4 categories of the ROTATE instruction: Rotate accumulator left (RLC), Rotate accumulator left through carry (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 explain 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 D2 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 D2 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 D0 becomes D7. Carry flag CY is modified according to the bit D0. For example:

A = D7 D6 D5 D4 D3 D2 D2 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 D2 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.

## Recommended Posts:

- COMPARE Instructions in 8085
- Logical instructions in 8085 microprocessor
- Branching instructions in 8085 microprocessor
- Arithmetic instructions in 8085 microprocessor
- Data transfer instructions in 8085 microprocessor
- 8085 program to multiply two 8 bit numbers using logical instructions
- Machine Instructions
- Difference between CALL and JUMP instructions
- Logical instructions in 8086 microprocessor
- Arithmetic instructions in 8086 microprocessor
- String manipulation instructions in 8086 microprocessor
- Data transfer instructions in 8086 microprocessor
- Process control instructions in 8086 microprocessor
- Register content and Flag status after Instructions
- Program execution transfer instructions in 8086 microprocessor

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.