Intro to COA

# 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.

1. Arithmetic Instructions
2. Logical and bit manipulation instruction
3. Shift instruction

### 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.

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.