Write an 8085 program to add 8-bit hexadecimal number sum of 8-bit data - ChromeTechny
Home » Write an 8085 program to add 8-bit hexadecimal number sum of 8-bit data
8085

Write an 8085 program to add 8-bit hexadecimal number sum of 8-bit data

wap-to-store-the-content-of-any-ml-in-any-register-using-immediate-addressing-mode

 

So far in this series, we have just copied the content of accumulator to a memory location or either in any register.

But from now onwards, we will start using various arithmetic instructions which are supported by 8085 microprocessor such as ADD, ADI, SUB, etc.

Moving on, for this 8085 program we will need two 8-bit data, and then we need to store the result in any given General Purpose Register.

Now in order to begin our program, the first we’ll need to is take two 8-bit numbers. In order to make the program shorter, we will use Accumulator and another GPR to store the two 8-bit data.

Input:

Let the first 8-bit data be A9H, and the second 8-bit data be 2DH.

After doing their addition, we get D6H. So, at the end of the program, the selected register holds the 8-bit data D6H.

Program:

MVI A, A9H //using move immediate instruction we move the first 8-bit data in accumulator

MVI C, 2DH//similar to the above instruction, we now move the second 8-bit data in C register

ADD C //after moving the content we now add the content of accumulator and the content of C register

MOV C,A //  after addition, we now move the result stored in accumulator in C register

HLT //finally we halt the program using HLT

 

Programming Details
Memory Location OPCODE Operand Label Hex Code
2000 MVI A, A9H 3EH
2001 A9H
2002 MVI C,2DH OEH
2003 2DH
2004 ADD C 20H
2005 MOV C,A 4FH
2006 HLT 76H

 

 

About the author

Ayan