Arithmetic Instructions of 8085

Arithmetic instructions of 8085 perform arithmetic operations such as addition, subtraction, increment, and decrement.

AdditionAny 8-bit number or the contents of a register or the contents of a memory location can be added to the contents of the accumulator and the sum is stored in the accumulator. No two other 8-bit registers can be added directly (e.g., the contents of register B cannot be added directly to the contents of register C).
SubtractionAny 8-bit number, or the contents of a register, or the contents of a memory location can be subtracted from the contents of the accumulator and the results stored in the accumulator. The subtraction is performed in 2’s complement, and the results if negative, are expressed in 2’s complement. No two other registers can be subtracted directly.
Increment/DecrementThe 8-bit contents of a register or a memory location can be incremented or decremented by 1. Similarly, the 16-bit contents of a register pair (such as BC) can be incremented or decremented by 1. These increment and decrement operations differ from addition and subtraction in an important way; i.e., they can be performed in any one of the registers or in a memory location.

The arithmetic instructions groups include the following instructions:

1.ADD R2.ADD M3.ADC R4.ADC M
5.ADI data6.ACI data7.DAD Rp8.SUB R
9.SUB M10.SBB R11.SBB M12.SUI data
13.SBI data14.DAA15.INR R16.INR M
17.DCR R18.DCR M19.INX Rp 20.DCX Rp

ADD R

MnemonicsADD R
OperationA = A + R
No. of Byte1 byte
Machine Cycle1 (OF)
AlgorithmA <- A + R
FlagsAll the flags are modified
Addr. ModeRegister addressing mode
T-states4

Description Add register R contents to the accumulator.
This instruction adds the contents of register R and accumulator. The result is stored in the accumulator.
The register R can be any general-purpose register like A, B, C, D, E, H, or L.
In addition to the result in the accumulator, all the flags are modified to reflect the result of the operation.
Example
ADD C
Let A = 47 H, C = 51 H and instruction ADD C is executed.

The examples of this instruction are:

ADD AADD BADD CADD D
ADD EADD HADD L

ADD M

MnemonicsADD M
OperationA = A + M or A = A + (HL)
No. of Byte1 byte
Machine Cycle2 (OF + MR)
AlgorithmA <- A + M or A <- A + (HL)
FlagsAll the flags are modified
Addr. ModeIndirect addressing mode
T-states4 + 3 = 7
Description Add memory location contents to the accumulator.
This instruction uses the HL register pair as a memory pointer. The contents of memory location addressed by the HL pair are added to the contents of the accumulator. The result is stored in the accumulator.
To reflect the status of the result all the flags are modified.
The contents of the memory location remain unchanged.
Example
ADD M
Let A = 15 H, H = COH, L = 05 H, at memory location C005 :02 H is stored and the instruction ADD M is executed.

ADC R

MnemonicsADC R
OperationA = A + R + CY
No. of Byte1 byte
Machine Cycle1 (OF)
AlgorithmA <- A + R + CY
FlagsAll the flags are modified
Addr. ModeRegister addressing mode
T-states4
Description Add register R and carry flag contents to the accumulator.
This instruction adds the contents of the specified register R to the contents of the accumulator with carry. The result is stored in the accumulator.
The register R is any general-purpose register like A, B, C, D, E, H, or L.
Example
ADC H
A = A+H+CY
Let A = 3F H, H = 20 H, CY = 1 and the instruction ADC H is executed.

The example of this instruction are:

ADC AADC BADC CADC D
ADC EADC HADC L

ADC M

MnemonicsADC M
OperationA = A + M + CY or
A = A + (HL) + CY
No. of Byte1 byte
Machine Cycle2 (OF + MR)
AlgorithmA <- A + M + CY or
A <- A + M + (HL)
FlagsAll the flags are modified
Addr. ModeIndirect addressing mode
T-states4 + 3 = 7
Description Add data in memory to the accumulator with carry.
This instruction uses the HL pair as a memory pointer.
The contents of the memory location addressed by the HL register pair and carry flag are added with the accumulator contents.
The result is stored in the accumulator.
Example
ADC M
A = A+(HL)+CY
Let A = 10 H, H = CO H, L = 02 H, CY = 1 and at memory location C002: 20 H is stored, and the instruction ADC M is executed.

ADI Data

MnemonicsADI Data
OperationA = A + data
No. of Byte2 byte
First Byte: Opcode
Second Byte: 8-bit data
Machine Cycle2 (OF + MR)
AlgorithmA <- A + data
FlagsAll the flags are modified
Addr. ModeImmediate addressing mode
T-states4 + 3 = 7
Description Add immediate 8-bit data to the accumulator.
This instruction adds the 8-bit data given within the instruction to the data in the accmulator.
The result is stored in the accumulator.
Example
ADI B7 H
This instruction will add B7 H to the accumulator and store results in the accumulator.

ACI Data

MnemonicsAcI Data
OperationA = A + 8-bit data + CY
No. of Byte2 byte
First Byte: Opcode
Second Byte: 8-bit data
Machine Cycle2 (OF + MR)
AlgorithmA <- A + data + CY
FlagsAll the flags are modified
Addr. ModeImmediate addressing mode
T-states4 + 3 = 7
Description Add immediate 8-bit data and carry it to the accumulator.
This instruction adds the 8-bit data, carry flag with the contents of the accumulator, and stores the results in the accumulator.
Example
ACI 20 H
This instruction will add 8-bit data, 20H to the contents of the accumulator, and the result is stored in the accumulator.

DAD Rp

MnemonicsDAD Rp
OperationHL = HL + Rp
No. of Byte1 byte
Machine Cycle3 (OF + BI + BI)
AlgorithmHL <- HL + Rp
FlagsOnly carry flag is affected. No other flags are modified to reflect the result of the operation.
Addr. ModeRegister addressing mode
T-states4 + 3 + 3 = 10
Description Add the specified register pair to the HL pair.
This instruction adds the contents of the specified register pair to the HL pair and stores the result in the HL pair.
The register pair R is a 16-bit register pair like BC, DE, HL, or stack pointer.
Only a higher order register is to be specified for the register pair within the instruction.
Only the carry flag is modified to reflect the status of the result.
ExampleDAD D
  • This is a one-byte instruction.
  • The operation is 16-bit addition. But as 8085 is an 8-bit processor, it requires additional time to complete the instruction execution.
  • At that time 8085 is busy in execution so it enters the bus idle machine cycle.
  • During the bus idle machine cycle, no operation on the bus was performed.
  • The fetching of the next instruction is stopped by not giving control signals RD and ALE. PC is not incremented by 1.
  • In all total 3 machine cycles required:
    • (1) OPCODE fetch
    • (2) Bus idle machine cycle
    • (3) Bus idle machine cycle.
  • OPCODE fetch: The program counter places address on the lower order address bus and the higher order address bus. The address for this machine cycle is given by PC. The PC is then incremented by 1.
  • Bus Idle cycles: This machine cycle is required to perform internal operation i.e.16-bit addition. During these machine cycles the buses are not in use.
  • The examples of this instrction are:
DAD BDAD DDAD HDAD SP

SUB R

MnemonicsSUB R
OperationA = A – R
No. of Byte1 byte
Machine Cycle1 (OF)
Algorithm A <- A – R
FlagsAll flags are modified to reflect the result of the operation.
Addr. ModeRegister addressing mode
T-states4
Description Subtract register from the accumulator
This instruction subtracts the contents of the specified register from the contents of the accumulator and the result is stored in the accumulator.
The contents of the registers R are not altered.
The register R can be any general-purpose register like A, B, C, D, E, H, or L.
Note: The subtraction is performed by using 2's complement method. 2's complement is done by the microprocessor itself. The programmer only specifies the two data bytes.
Example
SUB B
Let A = 37H, B = 40H and the instruction SUB B is executed.
B = 0100 0000
2’s complement of B = 1100 0000

The examples of this instruction are:

SUB ASUB BSUB CSUB D
SUB ESUB HSUB L

Hello friends, my name is Trupal Bhavsar, I am the Writer and Founder of this blog. I am Electronics Engineer(2014 pass out), Currently working as Junior Telecom Officer(B.S.N.L.) also I do Project Development, PCB designing and Teaching of Electronics Subjects.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

telegram logo Join Our Telegram Group!