programa11.doc
TRANSCRIPT
Microprocessor 8085 Appendix A Explanation : We are given two BCD numbers at memory locations D000 H and D001 H. Let these numbers be 02H and 09 H. We have to add the byte at memory location D000 H 02 H! with the byte at memory location D001H 09 H!. "nitially we will store the #irst number in the accumulator. $sing %DD instruction add the two contents. &esult o# addition will be stored in the % register. $sing D%% ad'ust the result to valid BCD number. (tore the result at memory location D002 H.)or e*am+le , D000 H- 02 H 02 HD001 H- 09 H . 09 HD%% 0B H invalid BCD! . 0/H11Hvalid BCD! Algorithm :Step I :(tartStep II : 0et the #irst number in % register.Step III: 0et the second number in memory.Step IV : %dd the two numbers.Step V : (tore the result at memory location D002 HStep VI : (to+ Flowchart : &e#er #lowchart 11. Program :Instruction CommentLXI H,D000 H ;HL points to the memory ; location D000 HMOVA,M ;Get the contents of location ; D000 H into the accumulator.IXH; Increment HL to point to ne!t memory ; location i.e. D00"H Flowchart 13ADDM ; A # A $M i.e. compute the a%%itionDAA ; &on'ert the H(X to 'ali% )&D result.IXH ; Increment HL to point to ne!t memory ; location i.e. D00*HMOVM, A; +tore the result at memory location ; D00* HHL, ; ,erminate thee!ecution of pro-ram