programa6.doc
TRANSCRIPT
Microprocessor 8085 Appendix A Explanation : We are given two 16 bit numbers at memory locations D000H, D001 H and D002 H, D003 H. Let these numbers be 123H and 0100 H. WehavetosubtractthewordatmemorylocationsD000HandD001H!123H"#romthewordat memorylocationsD002 H and D003 H !0100 H". We subtract the two L$%s and the two &$% se'arately. $tore the result at memory locations D00 H and D00( H. Algorithm :Step I: $tart Step II : )et the L$% o# #irst 16 bitnumber in *.Step III : )et the &$% o# the #irst number in register %.Step IV: )et the L$% o# the second number in register +Step V: )et the &$% o# the second number in register D Step VI : $ubtractthe L$% o# two numbers.Step VII : $tore the result o# L$% subtraction in register L.Step VIII:Load the &$% o# the #irst number in accumulator.Step IX : $ubtract the &$% o# two numbers.Step X: $tore the result o# &$% subtractionin register H.Step XI: $tore the result at memory locations D00 H and D00( H.Step XII: $to'. Flowchart : ,e#er #lowchart -. Program 1 :Instruction CommentLXIH, 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 Flowchart8MOV#, M; GetthecontentsD00"Hintore$ister#i.e. M%#of &rstnum'er.IXH ; Increment HL to point to ne!t memory location i.e. D00(HMOV), M; Get thecontents D00(Hintore$ister )i.e. L%#of (n*num'er. IXH ; Increment HL to point to ne!t memory location i.e. D00+HMOVD, M; Get the contents D00+ H into re$ister ) i.e. M%# of (n* num'er. %,#) ; )ompute L%# su'tractionA- A . )MOVL, A ; %tore the result in re$ister L.Microprocessor 8085 Appendix AMOVA, #; )opy the contents of M%# of &rst num'er to the accumulator.%,#D ; )ompute M%# su'tractionA- A . DMOVH, A ; %tore the result in re$ister H.%HLD(00/ H ; %toretheresultatmemorylocations(00/Han* (000 H.HL1