Microprocessor 8085 Appendix A
Microprocessor 8085 Appendix A
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
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