Micro 2
Micro 2
Practical 2
Aim: Application of data transfer instructions to develop relevant programs.
a) Write a program to copy content of register B to register C
b) Develop a program that load the accumulator with the content of memory location
pointed by DE pair and store it at 3000H.
c) Create a program that transfer data from memory location 2050H to register D.
d) Create a program that load the accumulator with the content of memory location
2050H using LDA and then store it at 3000H.Also move the content to register B.
e) Program to place content of 2001H in register C and 82H in register B and add both of
them.After adding transfer content of accumulator to register D.
Hardware Requirements: 8085 Microprocessor, Power Supply to provide the necessary
voltage and current to the components.
Introduction to data transfer group : A "data transfer group" in assembly language
consists of instructions designed to transfer data from source to destination without altering
the content of source.Some of the data transfer instructions are as follows:
MOV - Move
• Syntax: MOV destination, source
• This instruction copies the contents of the source operand (register/memory) into the
destination operand (register). It is used to transfer data between registers or between a
register and memory.
MVI - Move Immediate:
• Syntax: MVI destination, data
• Moves an immediate 8-bit data value directly into the specified register or memory
location. It is used to load immediate data into registers or memory.
LDA - Load Accumulator Directly from Memory:
• Syntax: LDA memory_address
• Loads the accumulator register with the 8-bit data stored at the specified memory
address. Used to fetch data from memory into the accumulator.
STA - Store Accumulator Directly in Memory:
• Syntax: STA memory_address
• Stores the content of the accumulator into the memory location specified by the memory
address. Used to store data from the accumulator into memory.
LHLD - Load HL Pair Directly from Memory:
• Syntax: LHLD memory_address
• Loads the H and L registers with a 16-bit value stored at the specified memory address.
It transfers a pair of registers from memory into the H and L registers.
SHLD - Store HL Pair Directly in Memory:
• Syntax: SHLD memory_address
• Stores the content of the H and L registers into memory at the specified address. It
transfers a pair of registers from the H and L registers to memory.
LXI - Load Register Pair with Immediate data:
• Syntax: LXI register_pair, data
• Loads a 16-bit immediate value into the specified register pair. Common register pairs
are BC, DE, HL.
LDAX - Load Accumulator from Address in Register Pair:
• Syntax: LDAX register_pair
• Loads the accumulator with the 8-bit data from the memory location addressed by the
specified register pair. Used for indirect memory access.
STAX - Store Accumulator in Address in Register Pair:
• Syntax: STAX register_pair
• Stores the content of the accumulator into the memory location addressed by the
specified register pair. Used for indirect memory storage.
XCHG - Exchange HL register pair with DE register pair :
• Syntax: XCHG
• Swaps the content of the HL register pair with DE register pair.
After this you will see 8085 kit will look like as
shown in fig (A.ii).
Flowchart:
Start
MVI B,02H
Transfer 8-bit immediate
data (02H) into register B
MOV C,B
Move the content of
register B to register C
Halt
Program:
Memory Address Machine Code Opcode Operands Comments
2021H 06,02 MVI B,02H Transfer 8-bit immediate data
i.e 02H into register B
2023H 48 MOV C,B Move the content of register B
to register C
2024H 76 HLT - Halt the program
2. After typing instructions save your file and after saving go to tools and click on assemble
to assemble instructions or to check it for errors. Fig(A.b) shows input instructions with
zero error.
Fig(A.c) Showing execution of each step on 8085 simulator (Source : Simulator software)
5. After successful completion of instructions when we see the value of register C it come
out to be 02H.
Output: The output of the program is that the value of register C equals to 02H which is
same as that of value of register B.This shows successful transferring of data from one
register to another.
B. Procedure for program that load the accumulator with the content of
memory location pointed by DE pair and store it at 3000H:
▪ Register used : D Initial Memory location :2021
After this you will see 8085 kit will look like as
shown in fig (B.i).
Fig(B.i) 8085 kit after pressing REL
EXMEM (Source: lab)
Teacher’s signature………… 10 | P a g e
Microprocessors CS 354 CO22329
Flowchart:
Start
LDAX D Load
accumulator indirect
Halt
Program:
Memory Address Machine Code Opcode Operands Comments
2021H 11,00,20 LXI D,2000H Load the data into a DE
register pair.
2024H 1A LDAX D Load accumulator indirectly
by the content of memory
location pointed by DE pair.
2025H 32,00,30 STA 3000H Store the content of
accumulator at 3000H
2028H 76 HLT - Halt the program
2. Close editor window and load program by clicking File and then go to load program
and select desired file.
3. Enter data at memory location 2000H as 06H.Memory editor will be shown in fig(B.b).
4. Click on rate and then check step by step option to execute the instructions step by
step.Then click on simulation and then on start to start execution of program and then
click on function key 2 to execute the next instructions as shown in fig(B.c) .
Fig(B.c) Showing execution of each step on 8085 simulator (Source : Simulator software)
5. After successful completion of instructions when we see the value at 3000H memory
address it come out to be 06H.Also no flag get affected in this case.
Output: The output of the program is that the value of accumulator is equals to 06H which
is same as that of value at memory location pointed by DE pair and 06H is stored at a 3000H
memory location.
Teacher’s signature………… 12 | P a g e
Microprocessors CS 354 CO22329
C. Procedure for program that transfer data from memory location 2050H to
register D. [ Register used : D and Initial memory location : 2021H ]
Supply power to 8085 microprocessor kit .
Press the RESET button then press REL
EXMEM.Now enter the starting address of your
program say 2021H.After entering address you
have to Press MEMC NEXT.
Type the hex code of the instruction in our case
first instruction is LXI H,2050H . Hexcode for
LXI is 21 after entering press
Fig(C.i) Entering Hexcode for LXI on kit
MEMC NEXT.This step is depicted by fig (C.i)
(source: lab)
Teacher’s signature………… 13 | P a g e
Microprocessors CS 354 CO22329
Teacher’s signature………… 14 | P a g e
Microprocessors CS 354 CO22329
Flowchart: Start
Halt
Program:
Memory Address Machine Code Opcode Operands Comments
2021H 21,50,20 LXI H,2050H Load the HL pair with 2050H
2024H 56 MOV D,M Move the content of memory
location pointed by HL pair
into a register D
2025H 76 HLT - Halt the program
Teacher’s signature………… 15 | P a g e
Microprocessors CS 354 CO22329
Procedure for program that transfer data from memory location 2050H to register
D on simulator.
1. First click on tools then go to assembler after that editor window will open type your
instructions there.After typing instructions save your file and after saving go to tools
and click on assemble to assemble instructions or to check it for errors. Fig(C.a)
shows input instructions with zero error.
4. Click on rate and then check step by step option to execute the instructions step by
step.Then click on simulation and then on start to start execution of program and then
click on function key 2 to execute the next instructions as shown in fig(C.c) .
Teacher’s signature………… 16 | P a g e
Microprocessors CS 354 CO22329
Fig(C.c) Showing execution of each step on 8085 simulator (Source : Simulator software)
6. After successful completion of instructions when we see the value of register D it come
out to be 02H.Also no flag get affected in this case.
Output: The output of the program is that the value of register D equals to 02H which is
same as that of value at memory location 2050H.This shows successful transferring of data
from memory location to register .
D. Procedure for program that load the accumulator with the content of
memory location 2050H using LDA and then store it at 3000H.Also move
the content to register B.
▪ Register used: B Initial Memory location :2021H
▪ Input location:2050H Flag affected :No flag affected
Supply power to 8085 microprocessor kit .
Press the RESET button to reset the 8085 kit and
then press REL EXMEM.
Now you have to enter the starting address of
your program say 2021H.
After entering address you have to Press MEMC
NEXT.
Type the hex code of the instruction in our case
first instruction is LDA 2050H . Hexcode for
Fig(D.i) Entering Hexcode for LDA on kit
LDA is 3A after entering press
(source: lab) MEMC NEXT.This step is depicted by fig (D.i)
Teacher’s signature………… 17 | P a g e
Microprocessors CS 354 CO22329
Teacher’s signature………… 18 | P a g e
Microprocessors CS 354 CO22329
Teacher’s signature………… 19 | P a g e
Microprocessors CS 354 CO22329
Teacher’s signature………… 20 | P a g e
Microprocessors CS 354 CO22329
Flowchart:
Start
LDA,2050H Load
accumulator direct
Halt
Program:
Memory Address Machine Code Opcode Operands Comments
2021H 3A,50,20 LDA 2050H Load accumulator directly by
the content of memory
location 2050H.
2024H 47 MOV B,A Move the content from
accumulator to register B
2025H 32,00,30 STA 3000H Store the accumulator content
at 3000H memory location.
2028H 76 HLT - Halt the program
Teacher’s signature………… 21 | P a g e
Microprocessors CS 354 CO22329
2. Close editor window and load program by clicking File and then go to load program
and select desired file.
3. Enter data at memory location 2050H as 05H.Memory editor will be shown in fig(D.b)
4. Click on rate and then check step by step option to execute the instructions step by
step.Then click on simulation and then on start to start execution of program and then
click on function key 2 to execute the next instructions as shown in fig(D.c) .
Fig(D.c) Showing execution of each step on 8085 simulator (Source : Simulator software)
5. After successful completion of instructions when we see the value of register B it come
out to be 05H and value at 3000H memory location is also 05H.
Output: The output of the program is that the value of register B equals to 05H which is
same as that of value at memory location 2050H and 05H is stored at a 3000H memory
location.
Teacher’s signature………… 22 | P a g e
Microprocessors CS 354 CO22329
Teacher’s signature………… 23 | P a g e
Microprocessors CS 354 CO22329
Teacher’s signature………… 24 | P a g e
Microprocessors CS 354 CO22329
Teacher’s signature………… 25 | P a g e
Microprocessors CS 354 CO22329
Flowchart: Start
Halt
Teacher’s signature………… 26 | P a g e
Microprocessors CS 354 CO22329
Program:
Memory Address Machine Code Opcode Operands Comments
2021H 21,01,20 LXI H,2001H Load HL pair with 2001H
2024H 4E MOV C,M Move the content of memory
location pointed by HL pair
to register C.
2025H 06,82 MVI B,82H Move immediate data 82H to
register B
2027H 79 MOV A,C Move content of register C to
accumulator .
2028H 80 ADD B Add content of register B to
accumulator
2029H 57 MOV D,A Move content of accumulator
to register D .
202AH 76 HLT - Halt the program
2. After typing instructions save your file and after saving go to tools and click on assemble
to assemble instructions or to check it for errors. Fig(E.b) shows input instructions with
zero error.
Teacher’s signature………… 27 | P a g e
Microprocessors CS 354 CO22329
3. Close editor window and load program by clicking File and then go to load program
and select desired file.
4. Enter data at memory location 2001H as 01H.Memory editor will be shown in fig(E.c).
5. Click on rate and then check step by step option to execute the instructions step by
step.Then click on simulation and then on start to start execution of program and then
click on function key 2 to execute the next instructions as shown in fig(E.d) .
Fig(E.d) Showing execution of each step on 8085 simulator (Source : Simulator software)
Teacher’s signature………… 28 | P a g e
Microprocessors CS 354 CO22329
6. After successful completion of instructions when we see the value of register D it come
out to be 83H.Also Z,AC,P,CF flags get affected in this case.
Output:
The output of the program is that the value of register C equals to 01H which is same as that
of value at memory location 2001H and value of register B is 82H.After adding both their
result will be stored in register D (i.e 83 H)
Precautions:
1. Handle the kit carefully.
2. Press the Microprocessor kit keys properly.
3. Ensure the correct power supply voltage and polarity according to the trainer kit's
specifications.
Lesson Learnt: Through this experiment I have learned how to use data transfer instructions
set on microprocessor trainer kit as well as on the 8085 simulator. I learned about the
functionality of various instructions like MOV, LDA, STA, MVI, LXI and LDAX etc.
Teacher’s signature………… 29 | P a g e