practical 2 data transfer
TRANSCRIPT
-
7/28/2019 Practical 2 Data Transfer
1/3
2.1
AIM: - To study various DATA TRANSFER instructions
THEORY: -
Data transfer instructions performs the primary function of copying data, from a
register or I/O or memory, which is called the source, to another register or I/O or
memory, which is called the destination.
Data transfer (copy) instructions can be used to copy data
From register to register.
Load an 8 bit number in a register.
Between memory and register.
Between I/O and accumulator.
Load 16 bit number in a register pair.
DATA TRANSFER INSTRUCTION SET:-
The following notations are used in the description of the instructions.
R = 8-bit register (A, B, C, D, E, H, L)
M = memory register (location)
RS = register source (A, B, C, D, E, H, L)
RD = register destination (A, B, C, D, E, H, L)
RP = register pair (BC, DE, HL)
Sr. No. Instruction No. of
Bytes
Description
Opcode Operand
1 MOV RD,RS 1 Copy data from RS to RD.
2 MOV M,R 1 Copy the data byte from
register R into memory location
whose address is stored in HL
register pair.
3 MOV R,M 1 Copy the data byte from a
memory location whose
address is stored in HL register
pair into a register R.4 MVI R, 8-bit 2 Load 8-bit data into a register
R.
5 MVI M, 8-bit 2 Load 8-bit data into memory
location whose address is
stored in HL register pair.
6 LXI RP, 16-bit 3 Load 16 bit of data in register
pair Rp
7 LDA 16-bit 3 Copy the data byte into the
accumulator from the memory
location indicated by 16-bitaddress.
ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE, RAJKOT
Subject:
Microprocessor and
Interfacing
Title:
To study data transfer instructions
Experiment No.02DATE:
Rev. No.
1.00
-
7/28/2019 Practical 2 Data Transfer
2/3
2.2
8 STA 16-bit 3 Copy the data byte of the
accumulator into the memory
location indicated by 16-bit
address.
9 LDAX Rp 1 Copy the data byte into the
accumulator from the memory
location indicated by a registerpair Rp. (Rp = BC or DE)
10 STAX Rp 1 Copy the data byte from the
accumulator into the memory
location indicated by a register
pair Rp. (Rp = BC or DE)
11 LHLD 16-bit 3 Copy the contents of memory
location indicated by 16-bit
address in register L & copy the
contents of next memory
location in register H.
12 SHLD 16-bit 3 Store the contents of register Lin memory location indicated
by 16-bit address & the
contents of H register are stored
in next consecutive memory
location.
13 PCHL 1 Store the contents of registers
pair HL into the program
counter.
14 SPHL 1 Loads the contents of register
pair HL into the stack pointer.
15 XCHG 1 The contents of register H are
exchanged with the contents of
register D, & the contents of
register L are exchanged with
the contents of register E.
16 XTHL 1 The contents of L register are
exchanged with the stack
location pointed out by stack
pointer. the contents of the H
register are exchanged with the
next stack location (SP+1).17 IN 8 bits 2 Accept data byte from an i/p
device & place it in the
accumulator.
18 OUT 8 bits 2 Send data byte from the
accumulator to an o/p device.
No flags are affected due to data transfer instructions.
ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE, RAJKOT
-
7/28/2019 Practical 2 Data Transfer
3/3
2.3
EXERCISE
1) Write single equivalent instruction for the following programs.
a) MVI D, F0H b) MOV A, L
MVI E, 00H STA F000H
XCHG MOV A, H
MOV M, A STA F001H
2) Write an assembly language program to interchange the data content stored at memory
location F000H and F001H.
3) Write an assembly language program to interchange the 16-bit data stored in register BC
and register DE (with and without XCHG instruction).
4) Two 16-bit data are stored in consecutive memory location starting from F000H with
lower bytes stored first. Write an assembly language program to copy this data in four
consecutive memory locations starting from D000H.
5) Write an assembly language program to load register pair BC and DE with 16-bit of data
F0F1H and E0E1H respectively and copy this data in consecutive memory location
starting with lower bytes first.
6) Write and A.L.P. to delete the data byte (i.e. make 00H) stored at memory location
whose address is stored at DE register pair.
Grade Lab-In-Charge H.O.D.
ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE, RAJKOT