0% found this document useful (0 votes)
125 views

Microprocessor 8085 Appendix A

The document describes adding two BCD numbers stored in memory locations D000H and D001H. The algorithm loads the first number into the accumulator, then loads and adds the second number. The DAA instruction adjusts the result to a valid BCD format, which is then stored in memory location D002H. The flowchart and program are provided to demonstrate loading the numbers, performing the addition, adjusting the result, and storing the output.

Uploaded by

manpreet kaur
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views

Microprocessor 8085 Appendix A

The document describes adding two BCD numbers stored in memory locations D000H and D001H. The algorithm loads the first number into the accumulator, then loads and adds the second number. The DAA instruction adjusts the result to a valid BCD format, which is then stored in memory location D002H. The flowchart and program are provided to demonstrate loading the numbers, performing the addition, adjusting the result, and storing the output.

Uploaded by

manpreet kaur
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Microprocessor 8085

Appendix A

Explanation :

We are given two BCD numbers at memory locations D000 H and D001 H. Let these numbers be 02
H and 09 H.
We have to add the byte at memory location D000 H (02 H) with the byte at memory location D001
H (09 H).
Initially we will store the first number in the accumulator.
Using ADD instruction add the two contents. Result of addition will be stored in the A register.
Using DAA adjust the result to valid BCD number.
Store the result at memory location D002 H.
For example :

D000 H = 02 H
D001 H = 09 H

02 H
+

DAA

09 H
0B H (invalid BCD)

06 H
11 H ( valid BCD)

Algorithm :
Step I : Start
Step II : Get the first number in A register.
Step III : Get the second number in memory.
Step IV : Add the two numbers.
Step V : Store the result at memory location D002 H
Step VI : Stop

Flowchart : Refer flowchart 13.

Program :
Instruction
LXI H,
MOV
INX H
ADD
DAA
INX H
MOV
HLT

Comment
D000 H
;
HL points to the memory
; location D000 H
A,M
;
Get the contents of location
; D000 H into the accumulator.
;
Increment HL to point to next memory
; location i.e. D001H
Flowchart 13
M
;
A = A +M i.e. compute the addition
;
Convert the HEX to valid BCD result.
;
Increment HL to point to next memory
; location i.e. D002H
M, A
;
Store the result at memory location
; D002 H
; Terminate the execution of program

You might also like