Search code examples
assemblyx86movrestrictions

the why of MOV command restrictions


why is MOV variable,variable incorrect? or why must we have only registers or an immediate if we use a variable as the first operand? or why is this wrong: MOV [x],anything except an immediate or register how these rules are defined? EDIT: I'm talking about a 8086 processor.


Solution

  • x86 MOV instructions simply do not support both a load and a store in the same instruction.

    You can either load from memory to a register, or store a register to memory. If you want to copy memory to memory in one instruction you need the MOVS instruction, which takes two pointers and copies them.