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

Program, move a byte string ,16 bytes long from the offset 0200H to 0300H i...

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

Programming., a program that display English letters excluding vowels

a program that display English letters excluding vowels

Assembling a program-microprocessor, Assembling a program Microsoft Ass...

Assembling a program Microsoft Assembler MASM is one of the simple to use and famous assemblers.  All the references and discussions in this section are belonging to the MASM.

Dq-dt-assemblers directive-microprocessor, DQ:   Define  Quad word:-  Th...

DQ:   Define  Quad word:-  This directive is taken in use to direct the assembler to reserve 4 words (8 bytes) of memory for the specified variable and can initialise it having

Project, I need some guidance on which project to make in assembly language...

I need some guidance on which project to make in assembly language

Write an assembly language program, Your assignment for this project is to ...

Your assignment for this project is to write an assembly language program that checks if the user's input is a valid ISBN number. A sample run of your program might look like:

Any project ideas plz, can any one help me in my project by using assembly ...

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

Relocate program and data, ) What is the difference between re-locatable pr...

) What is the difference between re-locatable program and re-locatable data?

Or-logical instruction-microprocessor, OR: Logical OR: The OR instruction ...

OR: Logical OR: The OR instruction carries out the OR operation in the similar way as described in case of the AND operation. The restriction on source and destination operands ar

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