programa2.doc

3
Microprocessor 8085 Appendix A ØØ Explanation : We have to exchange the contents of memory locations D000 H and D001 H. Initially we will load the contents of memory location D000 H to the accumulator. Store the contents of accumulator in register B. Now, load the contents of memory location D001 H to the accumulator. Store this number at memory location D000 H. Load the stored number in register B back to the accumulator and store the contents of accumulator to memory location D001 H. ØØ Algorithm : Step I : Load the accumulator with the contents of memory location D000 H. Step II : Copy the contents of accumulator to the register B. Step III : Load the accumulator with the contents of memory location D001 H. Step IV : Store the contents of accumulator to memory location D000 H. Step V : Copy the contents of register B to the accumulator. Step VI : Store the contents of accumulator to memory location D001 H. Step VII : Stop. ØØ Flowchart : Refer Flowchart 2 and Flowchart 3. ØØ Program – I : Instruction Comment LDA D000 H ; Load data from one memory location MOV B, A ; Store it in B reg. LDA D001 H ; Load data from second ; memory location STA 2000 H ; Store data of second ; memory location to first ; memory location. MOV A, B ; Recall data of first location Flowchart 2 STA 2001 H ; Store it in second memory location HLT ; Stop

Upload: manpreet-kaur

Post on 19-Aug-2015

4 views

Category:

Documents


1 download

TRANSCRIPT

Microprocessor 8085 Appendix AExplanation : We have to exchange the contents of memory locations D000 H and D001 H. Initially we will loadthe contents of memory location D000 H to the accumulator. Store the contents of accumulator in register B. Now load the contents of memory location D001 H to the accumulator. Store this num!er at memorylocation D000 H. "oad the stored num!er in register B !ac# to the accumulator and store the contents of accumulatorto memory location D001 H. Algorithm :Step I: "oad the accumulator with the contents of memory location D000 H. Step II: $o%y the contents of accumulator to the register B.Step III: "oad the accumulator with the contents of memory location D001 H.Step IV: Store the contents of accumulator to memory location D000 H.Step V: $o%y the contents of register B to the accumulator.Step VI : Store the contents of accumulator to memorylocation D001 H.Step VII : Sto%. Flowchart : &efer 'lowchart ( and 'lowchart ). Program I :InstructionCommentLDAD000 H; Load data from one memory locationMOVB, A; Store it in B reg.LDAD001 H; Load data from second ; memory locationSTA000 H; Store data of second ; memory location to !rst ;memory location.MOVA, B; "ecall data of !rst locationFlowchart2STA001 H; Store it in second memory locationHLT ; Sto# Program II :InstructionCommentLHLD D000 H; Load HL $it% data at D000 H and D001 HMOVA, H; second &yte in A''MOVH, L; !rst &yte in HMOVL, A; second &yte in LSHLDD000 H ; Store HLHLT ; StoMicroprocessor 8085 Appendix AFlowchart 3 Program III :InstructionCommentL()H, D000 H; HL #ointing to D000 HL()D, D001 H; D* #ointing to D001 HMOVB, M; B+HL, +!rst &yte,LDA( D; Load second &yte in A''.('H-; *.c%ange D* and HL #air contents.MOVM, B; Store !rst &yte in second locationSTA( D; Store second &yte in !rst location.HLT; Sto#