**Data Manipulation Instructions**

Data Manipulation instructions perform operations on data to change (manipulate) it and some computational capabilities.

**Types of Data Manipulation Instructions**

Data manipulation instructions have three basic types.

- Arithmetic Instructions
- Logical and bit manipulation instruction
- Shift instruction

**I. Arithmetic Instructions**

Name |
Mnemonic |
Explain |

Addition | ADD | This instruction adds the two numbers |

Addition with Carry | ADDC | This instruction adds the two numbers with the carry bit |

Addition of Floating No. | ADDF | This instruction adds the two floating numbers |

Addition of Integer No. | ADDI | This instruction adds the two integer numbers |

Addition of Decimal No. | ADDD | This instruction adds the two decimal numbers |

Subtraction | SUB | This instruction subtracts the two numbers |

Subtraction with borrow | SUBB | This instruction subtracts the two numbers with a borrowed bit |

Multiplication | MUL | This instruction multiplies the two numbers |

Division | DIV | This instruction divides the two numbers |

Increment | INC | This instruction adds 1 to the value stored in the register or memory |

Decrement | DEC | This instruction decreases 1 in the value stored in the register or memory |

Negate | NEG | This instruction performs the 2’s complement of the given value. |

**Example of ****Arithmetic**** Instruction**

**Operation: **Addition with Carry

**ii. Logical And Bit Manipulation Instructions**

Some logical operation on binary data stored in registers is explained under

Name |
Mnemonics |
Explanation |

Complement | COM | Complement instruction produces the 1’s complement by inverting all bit’s values. |

Clear | CLR | This instruction sets all bits to 0s of a specific register. Or it clears the data. |

OR | OR | OR, XOR, and AND operations perform corresponding operations on individual bits of operand/data. |

Exclusive OR | XOR | |

AND | AND | |

Set Carry | SETC | Carry bit can be set through SETC |

Clear Carry | CLRC | Carry it can be cleared or zero by CLRC |

Complement Carry | COMC | Invert the carry value by COMC |

Enable interrupt | EI | It allows the incoming instructions to execute first before the completion of the previous instruction. |

Disable interrupts | DI | It allows the incoming instructions to execute later before the completion of the previous instruction. |

**Example of Logical And Bit Manipulation Instructions**

**Operation: **AND

**iii. Shift instruction**

Shift instruction is used to shift an operand (bit by bit) to the left or to the right direction. The direction of the shift is dependent upon the specific instruction.

General shift instructions are

Name | Mnemonics | Explain |

Logical Shift Right | SHR | It moves each bit, One position, to the right. The free-spaced most significant bit (MSB) is filled with zero, and the LSB is discarded. |

Logical Shift Left | SHL | It moves each bit, One position, to the left. The free-spaced least significant bit (LSB) is filled with zero, and the most significant bit (MSB) is discarded. |

Arithmetic Shift Right | SHRA | Copy the MSB bit and place it in MSB and the second Last MSB bit. And discard one bit from the left side. |

Arithmetic Shift Left | SHLA | It is the same as SHL |

Rotate Right | ROR | Copy the LSB bit to the MSB position. |

Rotate Left | ROL | Copy the MSB bit to the LSB position. |

Rotate Right through Carry | RORC | Copy the LSB bit to the MSB position with carry. |

Rotate Left through Carry | ROLC | Copy the MSB bit to the LSB position with carry. |

**Examples of Shift Instructions**

All of the above shift instructions are explained below in the diagram.

Above all, cases show us to move one bit at a time. If we want to move 8 bits, then repeat the same procedure 8 times. In this way, 8 bits will be moved. Generally, if we want to move more than one bit at a time, then we apply a loop.