Arithmetic Instructions in 8085 Microprocessor

Arithmetic Instructions in 8085 Microprocessor includes the instructions, which performs the addition, subtraction, increment or decrement operations. The flag conditions are altered after execution of an instruction in this group.

Arithmetic Instructions in 8085

Opcode

Operand

Explanation of Instruction

Description

 ADD

R

M

Add register or memory, to accumulator

The contents of the operand (register or memory) are added to the contents of the accumulator and the result is stored in the accumulator. If the operand is a memory location, its location is specified by the contents of the HL registers. All flags are modified to reflect the result of the addition.                                              

Example: ADD B or ADD M

 ADC

R

M

Add register to accumulator with carry

The contents of the operand (register or memory) and M the Carry flag are added to the contents of the accumulator and the result is stored in the accumulator. If the operand is a memory location, its location is specified by the contents of the HL registers. All flags are modified to reflect the result of the addition.                                        

Example: ADC B or ADC M

 ADI

8-bit data

Add immediate to accumulator

The 8-bit data (operand) is added to the contents of the accumulator and the result is stored in the accumulator. All flags are modified to reflect the result of the addition.                               

Example: ADI 45H

 ACI

8-bit data

Add immediate to accumulator with carry

The 8-bit data (operand) and the Carry flag are added to the contents of the accumulator and the result is stored in the accumulator. All flags are modified to reflect the result of the addition.                                                                                                   

Example: ACI 45H

 LXI

Reg. pair, 16-bit data

Load register pair immediate

The instruction loads 16-bit data in the register pair designated in the operand.                     

Example: LXI H, 2034H or LXI H, XYZ

 DAD

Reg. pair

Add register pair to H and L registers

The 16-bit contents of the specified register pair are added to the contents of the HL register and the sum is stored in the HL register. The contents of the source register pair are not altered. If the result is larger than 16 bits, the CY flag is set. No other flags are affected.           Example: DAD H

SUB

R

M

Subtract register or memory from accumulator

The contents of the operand (register or memory ) are subtracted from the contents of the accumulator, and the result is stored in the accumulator. If the operand is a memory location, its location is specified by the contents of the HL registers. All flags are modified to reflect the result of the subtraction.

Example: SUB B or SUB M

 SBB

R

M

Subtract source and borrow from accumulator

The contents of the operand (register or memory ) and M the Borrow flag are subtracted from the contents of the accumulator and the result is placed in the accumulator. If the operand is a memory location, its location is specified by the contents of the HL registers. All flags are modified to reflect the result of the subtraction.

Example: SBB B or SBB M

 SUI

8-bit data

Subtract immediate from accumulator

The 8-bit data (operand) is subtracted from the contents of the accumulator and the result is stored in the accumulator. All flags are modified to reflect the result of the subtraction.

Example: SUI 45H

SBI

8-bit data

Subtract immediate from accumulator with borrow

The contents of register H are exchanged with the contents of register D, and the contents of register L are exchanged with the contents of register E.

Example: XCHG

 INR

R

M

Increment register or memory by 1

The contents of the designated register or memory) are incremented by 1 and the result is stored in the same place. If the operand is a memory location, its location is specified by the contents of the HL registers.

Example: INR B or INR M

INX

R

Increment register pair by 1

The contents of the designated register pair are incremented by 1 and the result is stored in the same place.

Example: INX H

 DCR

R

M

Decrement register or memory by 1

The contents of the designated register or memory are M decremented by 1 and the result is stored in the same place. If the operand is a memory location, its location is specified by the contents of the HL registers.

Example: DCR B or DCR M

DCX

R

Decrement register pair by 1

The contents of the designated register pair are decremented by 1 and the result is stored in the same place.

Example: DCX H

DAA

none

Decimal adjust accumulator

The contents of the accumulator are changed from a binary value to two 4-bit binary coded decimal (BCD) digits. This is the only instruction that uses the auxiliary flag to perform the binary to BCD conversion, and the conversion procedure is described below. S, Z, AC, P, CY flags are altered to reflect the results of the operation.

If the value of the low-order 4-bits in the accumulator is greater than 9 or if AC flag is set, the instruction adds 6 to the low-order four bits.

If the value of the high-order 4-bits in the accumulator is greater than 9 or if the Carry flag is set, the instruction adds 6 to the high-order four bits.

Example: DAA

Recent posts

Leave a Comment

Your email address will not be published. Required fields are marked *