Problem – Write an assembly language program to add two 8 bit numbers stored at address 2050 and address 2051 in 8085 microprocessor. The starting address of the program is taken as 2000.
- Load the first number from memory location 2050 to accumualtor.
- Move the content of accumulator to register H.
- Load the second number from memory location 2051 to accumaltor.
- Then add the content of register H and accumulator using “ADD” instruction and storing result at 3050
- The carry generated is recovered using “ADC” command and is stored at memory location 3051
|2003||MOV H, A||H<-A|
|2006||MOV L, A||L←A|
|2007||MVI A 00||A←00|
|200A||MOV H, A||H←A|
|200B||SHLD 3050||H→3051, L→3050|
- LDA 2050 moves the contents of 2050 memory location to the accumulator.
- MOV H, A copies contents of Accumulator to register H to A
- LDA 2051 moves the contents of 2051 memory location to the accumulator.
- ADD H adds contents of A (Accumulator) and H register (F9). The result is stored in A itself. For all arithmetic instructions A is by default an operand and A stores the result as well
- MOV L, A copies contents of A (34) to L
- MVI A 00 moves immediate data (i.e., 00) to A
- ADC A adds contents of A(00), contents of register specified (i.e A) and carry (1). As ADC is also an arithmetic operation, A is by default an operand and A stores the result as well
- MOV H, A copies contents of A (01) to H
- SHLD 3050 moves the contents of L register (34) in 3050 memory location and contents of H register (01) in 3051 memory location
- HLT stops executing the program and halts any further execution
- 8085 program to count total odd numbers in series of 10 numbers
- 8085 program to count total even numbers in series of 10 numbers
- 8085 program to add 2-BCD numbers
- 8085 program to add two 16 bit numbers
- 8085 program to swap two 8-bit numbers
- 8085 program to divide two 16 bit numbers
- 8085 program to multiply two 8 bit numbers
- 8085 program to divide two 8 bit numbers
- 8085 program to add numbers in an array
- 8085 program to multiply two 16-bit numbers
- 8085 program to sum of two 8 bit numbers without carry
- 8085 program to find the sum of first n natural numbers
- 8085 program to subtract two 16-bit numbers with or without borrow
- 8085 program to find larger of two 8 bit numbers
- 8085 program to find maximum of two 8 bit numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.