---
title: "Data manipulation instructions"
subject: "Computer Organization and Architecture"
chapter: 2
key: "semester_5/computer_organization_and_architecture:data-manipulation-instr"
source: https://www.bctengineer.com/q/semester_5/computer_organization_and_architecture/data-manipulation-instr
site: BCT Engineering
---

# Data manipulation instructions

Computer Organization and Architecture · Chapter 2: Central Processing Unit

- Asked in: 2078 Bhadra, 8 marks; 2073 Chaitra, 10 marks; 2067 Asar (old course), 8 marks (asked 3 times)
- Video: [Data Manipulation Instructions | Computer Organization & Architecture GATE Lectures | Well Academy](https://www.youtube.com/watch?v=nvsQMg0z6IA) — Well Academy
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_organization_and_architecture/data-manipulation-instr
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_organization_and_architecture/chapter-2

## Question

Explain the different types of data manipulation instructions with examples.

## Short answer

Data manipulation instructions perform arithmetic (ADD, SUB, MUL, DIV), logical (AND, OR, XOR, NOT for bitwise masking/setting/toggling), and shift operations (logical, arithmetic, rotate). They modify data and set condition flags for branching.

## Answer

Data manipulation instructions perform operations on data and give the computer its computational ability. They fall into three groups: arithmetic, logical and bit manipulation, and shift instructions. (The mnemonics follow the typical instructions listed by Mano.)

#### 1. Arithmetic instructions
| Name | Mnemonic | Example operation |
|---|---|---|
| Increment | INC | R1 = R1 + 1 |
| Decrement | DEC | R1 = R1 - 1 |
| Add | ADD | R1 = R1 + R2 |
| Subtract | SUB | R1 = R1 - R2 |
| Multiply | MUL | R1 = R1 × R2 |
| Divide | DIV | R1 = R1 ÷ R2 |
| Add with carry | ADDC | R1 = R1 + R2 + C |
| Subtract with borrow | SUBB | R1 = R1 - R2 - C |
| Negate (2's complement) | NEG | R1 = -R1 |

#### 2. Logical and bit manipulation instructions
| Name | Mnemonic | Effect |
|---|---|---|
| Clear | CLR | R = 0 |
| Complement | COM | R = R' |
| AND | AND | Clear selected bits (mask) |
| OR | OR | Set selected bits |
| Exclusive-OR | XOR | Complement selected bits |
| Clear carry | CLRC | C = 0 |
| Set carry | SETC | C = 1 |
| Complement carry | COMC | C = C' |
| Enable / disable interrupt | EI / DI | IEN = 1 / 0 |

Example: ANDing R1 with the mask 0000 1111 keeps the lower four bits: 1011 0110 AND 0000 1111 = 0000 0110.

#### 3. Shift instructions
| Name | Mnemonic | Effect |
|---|---|---|
| Logical shift right / left | SHR / SHL | Shift, insert 0 |
| Arithmetic shift right / left | SHRA / SHLA | Sign bit kept (right) |
| Rotate right / left | ROR / ROL | Bit leaves one end, enters the other |
| Rotate through carry | RORC / ROLC | Carry takes part in rotation |

Example: R1 = 1001 0110. SHR gives 0100 1011; SHRA gives 1100 1011; ROL gives 0010 1101.

These instructions change the processor status flags (carry, zero, sign, overflow), which are then tested by branch instructions.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Data manipulation instructions are grouped as
   A. Load, store, move
   B. Arithmetic, logical and bit manipulation, shift
   C. Jump, call, return
   D. Input, output, interrupt
   Answer: B. These are the three groups. (Key point: Three groups)

2. Which operation clears selected bits (masking)?
   A. OR
   B. XOR
   C. COM
   D. AND
   Answer: D. AND with 0 clears bits. (Key point: Masking)

3. R1 = 1001 0110. SHRA gives
   A. 0100 1011
   B. 1100 1011
   C. 0010 1101
   D. 0010 1100
   Answer: B. The sign bit is kept and copied. (Key point: Arithmetic shift right)

4. Why do these instructions change the status flags?
   A. To clear memory
   B. To set the PC
   C. To select registers
   D. Branch instructions test them
   Answer: D. Flags such as carry, zero, sign and overflow are tested by branches. (Key point: Flags)

## Related in Computer Organization and Architecture

- [Data manipulation: logical and bit instructions](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Alogical-bit-instr) — Computer Organization and Architecture, chapter 2, asked 2×
