Assembly language instruction MOV: copy the source operand to the destination operand

The MOV instruction copies the source operand to the destination operand. As the data transfer (data transfer) instruction, which is used in almost all programs. In its basic form, the first operand is a destination operand, the second operand is a source operand:

 

MOV destination,source

Wherein the content of the destination operand will change, but does not change the source operand. This data is moved from right to left with C ++ or Java, the assignment statement similar to:

= source;

In almost all assembly language instructions, the left operand is a destination operand and the right operand is a source operand. As long as the following rules, MOV instruction using the operands is very flexible.

  • Two operands must be the same size.
  • Two operands are not simultaneously a memory operand.
  • Instruction pointer register (IP, EIP or RIP) can not be used as the destination operand.

The following is the standard format of the MOV instruction:

  MOV reg, reg  MOV mem, reg  MOV reg, mem  MOV mem, imm  MOV reg, imm

Memory to memory

Single instruction MOV can not be used to transfer data directly from one memory location to another memory location. In contrast, before the value of the source operand operations assigned to memory, it must first be transferred to a register value:

  .data  var1 WORD ?  var2 WORD ?  .code  mov ax,var1  mov var2,ax

Tip: When copying integer constant to a variable or a register, the minimum number of characters needed to be considered constant.

Coverage value

The following code example demonstrates how to modify the same by use of a 32-bit register data of different sizes. When oneWord word transfer to the AX, AL, it overrides the value already. When oneDword transferred to the EAX, it overrides the value of AX. Finally, when a 0 is transmitted to the AX, it covers the lower half of the EAX.

  .data  oneByte BYTE 78h  oneWord WORD 1234h  oneDword DWORD 12345678h

4.1  Operand Type
4.2  MOV instructions
4.3  MOVZX to doing it and instructions MOVSX
4.4  LAHF SAHF instruction and
4.5 of 5  XCHG instructions
4.6  immediate offset operands
4.7  assembly language data transfer Example
4.8  addition and subtraction Detailed
4.9  the OFFSET operator
4.10  the ALIGN directive
4.11  the PTR operator
4.12  the TYPE operator
4.13  lengthof operator
4.14  the LABEL directive
4.15  indirect addressing
4.16  the JMP and LOOP instruction
4.17  64 MOV instruction
4.18  64-bit addition and subtraction

Guess you like

Origin blog.csdn.net/Javaxuxuexi/article/details/93401373