MOV (x86 instruction)

MOV (x86 instruction)

In the x86 assembly language, the MOV instruction is a mnemonic for the copying of data from one location to another. The x86 assembly language actually contains a number of different opcodes that perform a move. Depending on whether the processor is in real mode or protected mode, and an override instruction is used, the instruction may transfer 8-bits, 16-bits, or 32-bits of data. Data may be copied to and from memory and registers. [cite web |url=http://developer.intel.com/design/pentiumii/manuals/243191.htm|title=Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual|accessdate=2007-07-13]

One has to notice that using the mnemonic "move" for this operation may be seen as a misnomer, as the physical concept of "moving an object" from A to B (with place A now being empty) is changed to the concept of "making a copy" of the object at A to B (and possibly overwriting what was placed at B before).The following is an example of Intel syntax. The example copies the value in register Y into register X: MOV X, Y

This operation is represented by the following pseudocode: X := YWhile MOV X, Y is equivalent to X := Y, the reverse is often not true—especially in high-level programming languages such as Python, X := Y will translate into more complex assembly language.

In AT&T assembler syntax, the above operation would be accomplished as follows: MOVB $Y, X

Either X or Y can include addressing information.

The arguments for the MOV commands can be either a register, segment register or a memory address.since the command is executed in a single CPU work cycle, not all combinations of arguments are possible.possible combinations:

move the content of the register bx into the register ax MOV ax, bx

move the content of the register ax into the memory block with the specified address MOV [address] , ax

A combination which is not possible, is a move from memory to memory, for example : MOV [address1] , [address2]

to achieve this, another MOV must be used: MOV ax, [address2] MOV [address1] , ax

Usually, there is one set of opcodes for MOV register, [address] MOV [address] , register

Also there are special MOV opcodes for accessing control registers: MOV ax,CR0 MOV CR0,ax(Same for other control registers, test registers, and debug registers.)

If you want to move different sizes of data, consider using movzx.Example movzx syntax: MOVZX EAX,BH(The above code moves the higher byte of the 16-bit register BX into the 32-bit register EAX.)An example of what movzx does: MOVZX EAX,ALwill move the value of AL into EAX, padding it with zeroes.For example, if AL was 0x2F, EAX would be set to 0x0000002F.

References


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • X86 instruction listings — The x86 instruction set has undergone numerous changes over time. Most of them were to add new functionality to the instruction set.x86 integer instructionsThis is the full 8086/8088 instruction set, but most, if not all of these instructions are …   Wikipedia

  • MOV — may refer to: MOV (x86 instruction), a mnemonic for the copying of data from one location to another in the X86 assembly language .mov, filename extension for the QuickTime multimedia file format Metal oxide varistor, an electronic component with …   Wikipedia

  • X86 assembly language — is the assembly language for the x86 class of processors, which includes Intel s Pentium series and AMD s Athlon series. Like all assembly languages, it uses short mnemonics to represent the fundamental operations that the CPU in a computer can… …   Wikipedia

  • X86 calling conventions — This article describes the calling conventions used on the x86 architecture.Calling conventions describe the interface of called code: * The order in which parameters are allocated * Where parameters are placed (pushed on the stack or placed in… …   Wikipedia

  • Instruction set — Der Befehlssatz (englisch: instruction set, weshalb in der deutschen Sprache der Begriff Instruktion synonym für Befehl verwendet wird) bezeichnet in der Informatik die Menge der Maschinenbefehle eines Mikroprozessors. Der Umfang des… …   Deutsch Wikipedia

  • x86 debug register — On the x86 architecture, a debug register is a register used by a processor for program debugging. There are six debug registers, named DR0...DR7, with DR4 and DR5 as obsolete synonyms for DR6 and DR7. The debug registers allow programmers to… …   Wikipedia

  • X86 debug register — Debug register is a register used by a processor for program debugging. On the x86 architecture, these are named DR0...DR7. The debug registers allow programmers to selectively enable various debug conditions associated with the four debug… …   Wikipedia

  • Lenguaje ensamblador x86 — El lenguaje ensamblador x86 es la familia de los lenguajes ensambladores para los procesadores de la familia x86, que incluye desde los procesadores Intel 8086 y 8088, pasando por los Pentium de Intel y los Athlon de AMD y llegando hasta los… …   Wikipedia Español

  • Jeu d'instruction x86 — Article détaillé : Jeu d instructions. Le jeu d instructions du x86 a subi de nombreux changements au cours du temps. La plupart d entre eux ne sont que des ajouts au jeu d instruction initial afin d apporter de nouvelles fonctionnalités.… …   Wikipédia en Français

  • CMC (Instruction X86) — CMC est une instruction pour les processeurs de la famille x86. Sommaire 1 Description 1.1 Drapeaux affectés 1.2 Exceptions générées 2 …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”