Data Manipulation Instructions

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

Types of Data Manipulation Instructions

Data manipulation instructions have three basic types.

  1. Arithmetic Instructions
  2. Logical and bit manipulation instruction
  3. 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 borrow bit
Multiplication MUL This instruction multiplies the two numbers
Division DIV This instruction divides the two numbers
Increment INC This instruction add 1 in the value stored in register or memory
Decrement DEC This instruction decrease 1 in the value stored in register or memory
Negate NEG This instruction performs the  2’s complement of the given value.

Example of Arithmetic Instruction

Operation: Addition with Carry

Data Manipulation Instruction - Addition with Carry

ii. Logical And Bit Manipulation Instructions



Some logical operation on binary data store 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 set all bits to 0’s of specific register. Or it clears the data.
OR OR OR, XOR and AND operation 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 interrupt 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

Data Manipulation Instruction - AND Operation

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 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 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 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 LSB position with carry.

Examples of Shift Instructions

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

Data Manipulation Instruction - Shift Instructions

Above all cases shows 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.

Help Other’s By Sharing…

Contact Us

Burewala, Vehari, Punjab, Pakistan

cstaleem1@gmail.com

Website: CStaleem.com

Pin It on Pinterest