data copytransfer instructionsmov this data


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.

Example:

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:

Example:

1. PUSH AX

2. PUSH DS

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:

Example:

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:

Example:

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:

Example:

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:

Example:

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.

 

Request for Solution File

Ask an Expert for Answer!!
Assembly Language: data copytransfer instructionsmov this data
Reference No:- TGS0173499

Expected delivery within 24 Hours