The MOV instruction
The MOV instruction is used to copy data from one register to another or between a register and a memory location.
The MOV instruction format
| Instruction | Description |
|---|---|
| MOV reg8₁, reg8₂ | This format is used to transfer the contents of register reg8₂ to register reg8₁. Here reg8₁ and reg8₂ can be any general-purpose registers, namely A, B, C, D, E, H or L. |
| MOV reg8, mem8 | This format is used to transfer the contents of the memory location pointed to by the HL register pair to register reg8. Here reg8 can be any of the general-purpose registers. |
| MOV mem8, reg8 | This format is used to transfer the contents of register reg8 to the memory location pointed to by the HL register pair. |
Usage example
; Author: Evgeny Sergeevich Dovgopolov main: mvi a, 10h ; Copy the hexadecimal value 10h into register A mvi b, 20h ; Copy the hexadecimal value 20h into register B mov c, a ; Copy the value of register A into register C mov d, b ; Copy the value of register B into register D mov m, a ; Copy the value of register A into the memory pointed to by the HL register pair mov e, m ; Copy the value in the memory pointed to by the HL register pair into register E hlt ; Stop program execution
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".
Processor status flags
S
NoZ
NoAC
NoP
NoCY
No