Open In App

8085 program to sum of two 8 bit numbers without carry

Last Updated : 30 Jan, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

Problem – Write an assembly language program to sum two 8 bit numbers without using carry operation in 8085 microprocessor.

Assumption:

  1. The starting address of the program is 2000.
  2. Memory address of the first number is 2050.
  3. Memory address of the second number is 2051.
  4. Memory address of result is 2052.

Example:

Input: 2050: 03
     : 2-51: 04
Output: 2052: 07 

Algorithm:

  1. Load the first number to the accumulator through memory address 2050.
  2. Move the content of accumulator to the register B.
  3. Load the second number to the accumulator through memory address 2051.
  4. Add the content of accumulator and register B and result will be stored at the accumulator.
  5. Store the result from the accumulator to the memory address 2052.
  6. Terminate the program.

Program:

Memory Address MNEMONICS Comment
2000 LDA 2050 A<-[2050]
2003 MOV B, A B<-A
2004 LDA 2051 A<-[2051]
2007 ADD B A<-A+B
2008 STA 2052 [2052]<-A
200B HLT Terminate

Explanation:

  1. LDA 2050: This instruction will load the number from memory to the accumulator.
  2. MOV B, A: This instruction will move the content of accumulator to the register B.
  3. LDA 2051: This instruction will load the number from memory to the accumulator.
  4. ADD B: This instruction will sum the content of the accumulator with the content of the register B.
  5. STA 2052: This instruction will store the content of accumulator to the memory address 2052.
  6. HLT: This instruction will terminate the program.

Hence we successfully sum the two 8 bit numbers without carry using 8085 microprocessor.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads