8085 program to sum of two 8 bit numbers without carry
Problem – Write an assembly language program to sum two 8 bit numbers without using carry operation in 8085 microprocessor.
Assumption:
- The starting address of the program is 2000.
- Memory address of the first number is 2050.
- Memory address of the second number is 2051.
- Memory address of result is 2052.
Example:
Input: 2050: 03 : 2-51: 04 Output: 2052: 07
Algorithm:
- Load the first number to the accumulator through memory address 2050.
- Move the content of accumulator to the register B.
- Load the second number to the accumulator through memory address 2051.
- Add the content of accumulator and register B and result will be stored at the accumulator.
- Store the result from the accumulator to the memory address 2052.
- 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:
- LDA 2050: This instruction will load the number from memory to the accumulator.
- MOV B, A: This instruction will move the content of accumulator to the register B.
- LDA 2051: This instruction will load the number from memory to the accumulator.
- ADD B: This instruction will sum the content of the accumulator with the content of the register B.
- STA 2052: This instruction will store the content of accumulator to the memory address 2052.
- HLT: This instruction will terminate the program.
Hence we successfully sum the two 8 bit numbers without carry using 8085 microprocessor.
Please Login to comment...