programa18.doc

2
Microprocessor 8085 Appendix A Explanation : Consider that a block of data of N bytes is present at source location. Now this block of N bytes is to be moved from source location to a destination location. Let the number of bytes N = 10. We will have to initialize this as count in the C register. We know that source address is in the HL register and destination address is in the DE register. Get the byte from source memory block and store the byte in the destination memory block. Transfer data byte by byte from source to destination block till all the bytes are transferred. Algorithm : Step I : Initialize the register C with count. Step II : Initialize HL and DE with source and destination address. Step III : Get the byte from source memory block. Step IV : Transfer the data to destination block. Step V : Increment source memory pointer Step VI : Increment destination memory pointer. Step VII : Decrement Count. Step VIII : Check for count in C, if not zero goto step III Step IX : Stop. Flowchart : Refer flowchart 20. Program : Instruction Comment MVI C, 0AH ; Initialize counter LXI H, D000H ; Initialize source ; memory pointer LXI D, E000H ; Initialize destination ; memory pointer BACK: MOV A, M ; Get byte from source ; memory block STAX D ; Store byte in the ; destination

Upload: manpreet-kaur

Post on 19-Aug-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Microprocessor 8085 Appendix A Explanation : Consider that a block of data of N bytes is present at source location. Now this block of N bytes is tobe moved from source location to a destination location. Let the number of bytes N = 10. We will have to initialize this as count in the C reister. We know that source address is in the !L reister and destination address is in the "# reister. $et the byte from source memory block and store the byte in the destination memory block. %ransfer data byte by byte from source to destination block till all the bytes are transferred. Algorithm :Step I : &nitialize the reister C with count.Step II: &nitialize !L and "# with source and destination address.Step III: $et the byte from source memory block.Step IV:%ransfer the data to destination block.Step V : &ncrement source memory pointerStep VI:&ncrement destination memory pointer.Step VII: "ecrement Count.Step VIII: Check for count in C' if not zero oto step &&& Step IX: (top. Flowchart : )efer flowchart *0. Program :Instruction CommentMVIC, 0AH; Initialize counterLXIH, D000H; Initialize source ; memory pointerLXID, E000H; Initialize destination ; memory pointerBAC! M"VA, M; #et $yte %rom source ; memory $loc&'(AXD; 'tore $yte in t)e ; destination ;memory $loc&I*XH; Increment source ; memory pointerI*XD; Increment destination ; memory pointerDC+C; Decrement counter ,*-BAC; I% counter . 0 repeatFlowchart 20HL( ; (erminate pro/ram e0ecution