Arithmetic Instructions

Last Updated : 22 Oct, 2025

Arithmetic instructions in the 8085 microprocessor allow it to perform operations such as addition, subtraction, increment, decrement, and related tasks on data stored in registers, memory, or immediate values.

Types of Arithmetic Instructions

The arithmetic instructions can be broadly classified into the following types:

1. Addition Instructions

Addition is a fundamental arithmetic operation used extensively. The 8085 microprocessor supports various types of addition:

  • ADD r: Adds the content of register r (B, C, D, E, H, L, or A) to the accumulator (A). Example: ADD B adds the content of register B to accumulator A.
  • ADI data: Adds an 8-bit immediate data to the accumulator. Example: ADI 25H adds the hexadecimal value 25H to A.
  • ADC r: Adds the content of register r plus the carry flag to the accumulator. Used for multi-byte addition where carry propagation is necessary.
  • ACI data: Adds immediate data and the carry flag to the accumulator.
  • ADD M: Adds the content of the memory location pointed to by the HL pair to the accumulator.
arith
Add B execution in ALU

2. Subtraction Instructions

These instructions allow subtraction operations, often used in loops, comparisons, and arithmetic calculations:

  • SUB r: Subtracts the content of register r from the accumulator.
  • SUI data: Subtracts immediate 8-bit data from the accumulator.
  • SBB r: Subtracts the content of register r and the borrow (carry) flag from the accumulator.
  • SBI data: Subtracts immediate data and the borrow flag from the accumulator.
  • SUB M: Subtracts the content of memory pointed by HL from the accumulator.

3. Increment and Decrement Instructions

These instructions increase or decrease the value of registers or memory locations by 1:

  • INR r: Increment the content of register r by 1.
  • DCR r: Decrement the content of register r by 1.
  • INR M: Increment the content of the memory location pointed by HL.
  • DCR M: Decrement the content of the memory location pointed by HL.

4. Decimal Adjust Accumulator (DAA)

The 8085 microprocessor can operate on BCD (Binary Coded Decimal) numbers. After addition of two BCD numbers, the result in the accumulator may not be in valid BCD format. The DAA instruction adjusts the accumulator to produce a valid BCD number.

5. Rotate and Other Arithmetic-Related Instructions

Although primarily used for bit manipulation, rotate instructions also assist arithmetic operations such as multiplication or division by powers of 2:

  • RLC (Rotate Left Accumulator)
  • RRC (Rotate Right Accumulator)
  • RAL (Rotate Left through Carry)
  • RAR (Rotate Right through Carry)

Flags Affected by Arithmetic Instructions

Most arithmetic instructions affect the following flags in the 8085 flag register:

  • Sign (S)
  • Zero (Z)
  • Auxiliary Carry (AC)
  • Parity (P)
  • Carry (CY)

For example, addition and subtraction instructions set or reset the carry flag depending on overflow, set zero flag if the result is zero, etc.

Various Arithmetic Instructions

Following are arithmetic instructions with example, which can be executed in 8085 microprocessor:


Opcode & OperandExplanation & Example
ADD RA = A + R ADD B → A = A + B
ADI 8-bit dataA = A + Immediate 8-bit data ADI 50H → A = A + 50H
ADC RA = A + R + Previous Carry ADC B → A = A + B + CY
ACI 8-bit dataA = A + Immediate 8-bit data + Previous Carry ACI 50H
SUB RA = A - R SUB B → A = A - B
SUI 8-bit dataA = A - Immediate 8-bit data SUI 50H
SBB RA = A - R - Previous Carry SBB B → A = A - B - CY
SBI 8-bit dataA = A - Immediate 8-bit data - Previous Carry SBI 50H
INR RR = R + 1 INR B → B = B + 1
INX rpRegister Pair = Register Pair + 1 INX H → HL = HL + 1
DCR RR = R - 1 DCR B → B = B - 1
DCX rpRegister Pair = Register Pair - 1 DCX H → HL = HL - 1
DAD rpHL = HL + Register Pair DAD H → HL = HL + HL
Comment

Explore