Data Transfer Instructions:
These instructions are used for transferring data items from one source location to another location called destination. The source can be an immediate number, content of a register or memory or even an input from the peripheral and destination can be a register, memory or any peripheral.
The different instructions under data transfer category are listed in table below:
1 | MVI Reg/Mem,8-bit data | Move immediate 8-bit data in reg/memory |
2 | MOV Rd, Rs | Move content of source register to a destination register |
3 | MOV Rd, M | Move content of memory to a destination register |
4 | LXI Rp,16-bit Data | Move 16-bit immediate data to register pair (BC, DE, HL) |
5 | LDA 16-bit Address | Load Accumulator from memory whose 16-bit address is given |
6 | STA 16-bit Address | Store Accumulator from memory whose 16-bit address is given |
7 | LHLD 16-bit Address | Load HL pair direct from memory whose 16-bit address is given |
8 | SHLD 16-bit Address | Store HL pair in memory whose 16-bit address is given |
9 | LDAX [Rp] | Load Accumulator from memory whose 16-bit address is given in Register Pair |
10 | STAX [Rp] | Store Accumulator from memory whose 16-bit address is given in Register Pair |
11 | XCHG | Exchanges content of HL with DE register pair |
Example-1: Writa an ALP to transfer a data byte from memory location 2050h and store it at location 2060 h.
Answer:
- Using Direct addressing mode
LDA 2050h
STA 2060h
HLT
- Indirect addressing Mode
LXI D, 2050h
LDAX D
LXI D, 2060h
STAX D
HLT
Example-2: WAP to load a data byte 58h in accumulator and transfer the byte in register C and also in memory at address 2050h
Answer:
MVI A, 58h
MOV C, A
STA 2050h
HLT
Example-3: WAP in assembly language to exchange the 16-bit data
Answer:
LXI H, 1234h
LXI D, 2345h
XCHG
HLT