1.

Discuss the data copy / transfer instructions ?

Answer»

Data Copy / Transfer Instructions : 

MOV : 

This instruction copies a word or a byte of data from some source to a destination. The destination can be a register or a memory location. The source can be a register, a memory location, or an immediate number. 

MOV AX,BX 

MOV AX,5000H 

MOV AX,[SI] 

MOV AX,[2000H] 

MOV AX,50H[BX] 

MOV [734AH],BX 

MOV DS,CX 

MOV CL,[357AH] 

Direct loading of the segment registers with immediate data is not permitted. 

PUSH : Push to Stack 

This instruction pushes the contents of the specified register/memory location on to the stack. The stack pointer is decremented by 2, after each execution of the instruction. 

E.g. PUSH AX 

• PUSH DS 

• PUSH [5000H] 

Fig. 2 Push Data to stack memory 

POP : Pop from Sack

This instruction when executed, loads the specified register/memory location with the contents of the memory location of which the address is formed using the current stack segment and stack pointer. 

The stack pointer is incremented by 2 

Eg. POP AX 

POP DS 

POP [5000H] 

Fig 3 Popping Register Content from Stack Memory 

XCHG : Exchange byte or word 

This instruction exchange the contents of the specified source and destination operands 

Eg. XCHG [5000H], AX

XCHG BX, AX 

XLAT : 

Translate byte using look-up table 

Eg. LEA BX, TABLE1 

MOV AL, 04H 

XLAT 

Simple input and output port transfer Instructions: 

IN: 

Copy a byte or word from specified port to accumulator. 

Eg. IN AL,03H 

IN AX,DX 

OUT: 

Copy a byte or word from accumulator specified port. 

Eg. OUT 03H, AL 

OUT DX, AX 

LEA : 

Load effective address of operand in specified register. [reg] offset portion of address in DS 

Eg. LEA reg, offset 

LDS:

Load DS register and other specified register from memory. 

[reg] [mem] 

[DS] [mem + 2] 

Eg. LDS reg, mem 

LES:

Load ES register and other specified register from memory. 

[reg] [mem] 

[ES] [mem + 2] 

Eg. LES reg, mem

Flag transfer instructions: 

LAHF: 

Load (copy to) AH with the low byte the flag register. 

[AH] [ Flags low byte] 

Eg. LAHF 

SAHF: 

Store (copy) AH register to low byte of flag register. 

[Flags low byte] [AH] 

Eg. SAHF 

PUSHF: 

Copy flag register to top of stack. 

[SP] [SP] – 2 [

[SP]] [Flags] 

Eg. PUSHF 

POPF : 

Copy word at top of stack to flag register.

[Flags] [[SP]] 

[SP] [SP] + 2



Discussion

No Comment Found

Related InterviewSolutions