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

Copy a string backwards, I can get it to copy the string but can''t get it ...

I can get it to copy the string but can''t get it to reverse it.

Seg-segment-assemblers directive-microprocessor, SEG : Segment of a Label:...

SEG : Segment of a Label:- The SEG operator is which is used to decide the segment address of the, variable, label or procedure and substitutes the segment base address in plac

Whle loop, program to accept 23 students name using while loop let your var...

program to accept 23 students name using while loop let your variable control the value negative 4

Program help, Could I get an estimate on how much it would cost to write a ...

Could I get an estimate on how much it would cost to write a program in assembly language?

Assembly language programming, Write an assembly language program that defi...

Write an assembly language program that defines symbolic constants for all seven days of the week

Programming with an assembler-microprocessor, Programming with an assembler...

Programming with an assembler The procedure of hand-coding 8086 programs is somewhat tiresome; hence generally a programmer may find it hard to get a correct listing of the mac

8086 assembly language program, move a byte string ,16 bytes long from the ...

move a byte string ,16 bytes long from the offset 0200H to 0300H in the segment 7000H

maximim and minimum mode 8088-microprocessor, Maximim and Minimum mode 808...

Maximim and Minimum mode 8088 system : In the maximum mode, the pin 880 is lastingly high. The functions and timings of other pins of 8088 are exactly similar to 8086. Due to t

Microcontroller, bello need help with a final project , I have to do a pres...

bello need help with a final project , I have to do a presentation on a digital stop watch , but I have to use edsim51 to make it wondering if you guys can help me

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