programa3.doc

2
Microprocessor 8085 Appendix A ØØ Explanation : We are given two numbers at memory locations D000 H and D001 H. Let these numbers be 20 H and 50 H. We have to add the byte at memory location D000 H ( 20 H ) with the byte at memory location D001 H ( 50 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. Store the result at memory location D002 H. For example : D000 H = 20 H 20 H D001 H = 50 H + 50 H 70 H ØØ 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 4. ØØ Program : Instruction Comment LXI H, D000 H ; HL points to the memory location D000 H MOV A, M ; Get the contents of location Flowchart 4 ; D000 H into the accumulator. INX H ; Increment HL to point to next memory location i.e. D001H ADD M ; A = A +M i.e. compute the addition INX H ; Increment HL to point to next memory location i.e. D002H MOV M, A ; Store the result at memory location i.e. D002H

Upload: manpreet-kaur

Post on 19-Aug-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Microprocessor 8085 Appendix A Explanation : Wearegiventwonumbers at memorylocationsD000HandD001H. Let thesenumbers be20 H and 50 H. We have to add the byte at memory location D000 H ( 20 H ) with the byte at memory location D001H ( 50 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. %tore the result at memory location D002 H.&or e'am(le ) D000 H* 20 H 20 HD001 H * 50H + 50 H,0 H Algorithm :Step I : %tart Step II : -et the !irst number in # register.Step III : -et the second number in memory.Step IV : #dd the two numbers.Step V : %tore the result at memory location D002 H.Step VI : %to( Flowchart : $e!er !lowchart .. Program :InstructionCommentLXIH, D000 H ; HL points to the memory location D000 HMOVA, M; Get the contents of location Flowchart4; D000 H into the accumulator.IX H ; Increment HL to point to ne!t memory location i.e. D00"HADD M; A # A $M i.e. compute the a%%itionIX H ; Increment HL to point to ne!t memory location i.e. D00&HMOVM, A ; 'tore the result at memory location i.e. D00&HHL(