Data copy/transfer instructions-microprocessor, Assembly Language

Assignment Help:

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.

 


Related Discussions:- Data copy/transfer instructions-microprocessor

Machine coding the programs-microprocessor, Machine Coding the Programs ...

Machine Coding the Programs So far we have describe five programs which were  written  for hand coding  by a programmer. In this, we will now have a deep look at how these prog

Convert from C to 8086 assembly language, Trying to convert small programs ...

Trying to convert small programs from C to 8086 assembly language using emu 8086 emulator. I converted to low level C, but struggling with converting to the Assembly language.

Daa-arithmetic instruction-microprocessor, DAA: Decimal Adjust Accumulator...

DAA: Decimal Adjust Accumulator:- This instruction is utilized to convert the result of the addition operation of 2 packed BCD numbers to a valid BCD number. The conclusion has to

Length-assemblers directive-microprocessor, LENGTH : Byte Length of a Labe...

LENGTH : Byte Length of a Label: This directive is not available in MASM. This is used to mention to the length of a data array or a string. MOV CX. LENGTH ARRAY This sta

Dma hardware (8237 dmac)-microprocessor, DMA Hardware (8237 DMAC) : ...

DMA Hardware (8237 DMAC) :   1)Processor contain HOLD/HOLD Acknowledge lines to interact with 8237 o   DMAC can achieve control of ISA bus by asserting HOLD o   P

Second generation microprocessor, IInd Generation Microprocessor : The ...

IInd Generation Microprocessor : The second generation microprocessor by using n MOS technology seemed in the market in 1973.   The Intel  8080, of nMOS  technology

NASM assembly language programming, NASM assembly language program: Consid...

NASM assembly language program: Consider a sequence of 19 strictly positive decimal digits, most likely stored in an array. There are obviously duplicates, and the sequence is un

Summation Program., Write a program to solve problem 9, Summation Program, ...

Write a program to solve problem 9, Summation Program, on page 179 of chapter 5 in the textbook (book:kip Irvine Assembly Language sixth edition)

8086, Write a program to mask bits D3D2D1D0 and to set bits D5D4 and to inv...

Write a program to mask bits D3D2D1D0 and to set bits D5D4 and to invert bits D7D6 of ax register

ISBN CHECK, How do i convert a asci number to numerals?

How do i convert a asci number to numerals?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd