Sei sulla pagina 1di 3

Subject: Microprocessor and Interfacing Experiment No.

02 DATE:

Title: To study data transfer instructions

Rev. No.

1.00

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. 1 2 Instruction Opcode Operand MOV RD,RS MOV M,R No. of Bytes 1 1 Description Copy data from RS to RD. Copy the data byte from register R into memory location whose address is stored in HL register pair. Copy the data byte from a memory location whose address is stored in HL register pair into a register R. Load 8-bit data into a register R. Load 8-bit data into memory location whose address is stored in HL register pair. Load 16 bit of data in register pair Rp Copy the data byte into the accumulator from the memory location indicated by 16-bit address.
2.1

MOV

R,M

4 5 6 7

MVI MVI LXI LDA

R, 8-bit M, 8-bit RP, 16-bit 16-bit

2 2 3 3

ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE, RAJKOT

STA

16-bit

LDAX

Rp

10

STAX

Rp

11

LHLD

16-bit

12

SHLD

16-bit

13 14 15

PCHL SPHL XCHG

1 1 1

16

XTHL

17

IN

8 bits

Copy the data byte of the accumulator into the memory location indicated by 16-bit address. Copy the data byte into the accumulator from the memory location indicated by a register pair Rp. (Rp = BC or DE) Copy the data byte from the accumulator into the memory location indicated by a register pair Rp. (Rp = BC or DE) Copy the contents of memory location indicated by 16-bit address in register L & copy the contents of next memory location in register H. Store the contents of register L in memory location indicated by 16-bit address & the contents of H register are stored in next consecutive memory location. Store the contents of registers pair HL into the program counter. Loads the contents of register pair HL into the stack pointer. 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. 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). Accept data byte from an i/p device & place it in the accumulator. Send data byte from the accumulator to an o/p device.

18

OUT

8 bits

No flags are affected due to data transfer instructions.

ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE, RAJKOT

2.2

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

2.3

Potrebbero piacerti anche