Data copy/transfer instructions-microprocessor, Assembly Language

Data copy/transfer Instructions

MOV: This data transfer instruction transfers data from one register or memory location to another register or memory location. The source can be any one of the segment registers or other special or general purpose registers or a memory location and, another register or another memory location may behave as destination.

However, in case of immediate addressing mode a segment register can't be a destination register.  In other terms, direct loading of the segment registers with immediate data is not allowed.  To load the segment registers with  the immediate data, one will have to load any general-purpose register with data and then  it will  have  to  be  moved  to  that  specific  segment  register.  The following example instructions describe the fact.


Load  DS with 5000H.

1. MOV DS, 5000H; Not permitted (invalid)

So to transfer an immediate data into the segment register, the acute process is given below.

2. MOV AX, 5000H MOV DS, AX


It can be considered, here, that the source and the destination both operands cannot be memory locations (Except   for string instructions). Others MOV instructions examples are given below with the corresponding addressing modes.

3. MOV AX, 5000H; Immediate

4. MOV AX, BX; Register

5. MOV AX, [SI]; Indirect

6. MOV AX, [200 OH]; Direct

7. MOV AX, 50H [BX]; Based relative, 50H Displacement

PUSH: Push to Stack:- This instruction pushes the contents of the particular register/memory  location on to the stack. The stack pointer is decremented by value two, after each execution of the instruction. The real current stack-top is always occupied by previously pushed data. So, the push operation decrements SP by the two and then stores the 2 byte contents of the operand onto the stack. Firstly the higher byte is pushed and then the lower byte. Thus out of the two decremented stack addresses the higher byte occupies the higher address and the lower byte occupies the lower address. The instance of these instructions is as follows:




3. PUSH [500OH] ; Content of location 5000H and 5001 H in DS are pushed onto the stack.

POP: Pop from Stack:- This instruction when executed loads the  particular register/memory location with the contents of the memory location of which the address is formed  by using the current stack pointer and stack segment  usually. The stack pointer is incremented by  value 2. The POP instruction consider exactly opposite to the PUSH instruction.

The examples of these instructions are as shown:


1. POP   AX

2. POP   DS

3. POP   [5000H]

XCHG: Exchange:-This instruction exchanges the contents of the particular destination and source operands, which might be registers or one of them, might be a memory location. However, exchange of  the data contents of two memory locations is not allowed. The examples are as given below:


1. XCHG    [5000H], AX ; This instruction exchanges data between AX and a

                                  ; memory location [5000H] in the data segment    

2. XCHG      BX             ; This instruction exchanges data between AX and BX.

IN: Input the port: - This instruction is utilized for reading an input port. The address of the input port may be indicated in the instruction indirectly or directly. AX and AL are the permitted destinations for 8 and 16-bit input operations. DX is just a register (implicit) which is permitted to carry the port address. The examples are given below:


1. IN AL, 030 OH; this instruction reads the data from an 8-bit port whose address is 0300H and stores it in AL.

2. IN AX     ; this instruction reads data from a 16-bit port whose address is in DX (implicit) and stores it in AX.

OUT: Output to the Port:-This instruction is utilized for writing to an output port. The address of the output port can be specified in the instruction implicitly or directly in DX. Contents of AL or AX are transferred to a indirectly or directly addressed port after the execution of this instruction.  The data to an odd addressed port is transferred on the D8-D15 and an even addressed port is transferred on the D0-D7. The registers AX and AL are the permitted source operands for 16-bit and 8-bit operations respectively. The instance are given as shown:


1. OUT       0300H, AL ; this sends data available in AL to a port whose address is 0300H.

2. OUT       AX            ; This sends data available in AX to a port whose address is specified implicitly in DX.

XLAT:  Translate:-The translate instruction is utilized for finding  out the codes in case of code conversion problems, by  using look up table technique.  We will describe this instruction with the aid of the following instance.

LEA: Load Effective Address: - The load effective address instruction loads the offset of an operand in the particular register. This instruction is more useful for the assembly language rather than machine language. Imagine, in the assembly language program, a label ADR is used. The instruction LEA BX, ADR loads offset of the label ADR in the BX.


Posted Date: 10/11/2012 12:49:17 AM | Location : United States

Related Discussions:- Data copy/transfer instructions-microprocessor, Assignment Help, Ask Question on Data copy/transfer instructions-microprocessor, Get Answer, Expert's Help, Data copy/transfer instructions-microprocessor Discussions

Write discussion on Data copy/transfer instructions-microprocessor
Your posts are moderated
Related Questions
use"> use microsoft visual 2010 and http://www.asmirvine.c

DMA controller :     Steps include in transferring a block of data from I/O devices (for example a disk) to memory: 1. CPU sends a signal to initiate disk transfe

Write an application that does the following:(1) fill an array with 50 random integers; (2) loop through the array, displaying each value, and count the number of negative values;

Pin functions for the minimum mode operation of 8086 are following: 1) M/I/O -Memory/IO: This is a status line logically equivalent to S2 in maximum mode. When it is low, it

I need to estimate the value of a definite integral using Riemann Sums and For our estimation let f(x) = x2 ,a=0, b=10 and n=5. Where a is the lower bound, b is the upper bound and

can any one help me in my project by using assembly language

write a program that calculates the fibonacci series: except for the first two numbers in the sequence

i want to develop traffic light system so which kind of software is needed to develop this project?

AND: Logical AND: This instruction bit by bit ANDs the source operand that might be an immediate, or a memory location or register to the destination operand that might be a memor

Multiply two numbers by using shift and rotate instruction