1

i have a tiny question regarding to the following statement. Assume rax and rbx are pointing towards a valid memory address.

mov byte [rax], [rbx]

Why isn't that statement valid?

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
Metalhead
  • 81
  • 2
  • 7
  • 1
    You should review the [instruction set architecture reference](https://www.felixcloutier.com/x86/) for the [MOV](https://www.felixcloutier.com/x86/mov) instruction. The limitation is in the processor. There is no `MOV` encoding that moves from one memory location to another directly. You have to do it in two moves. Move the data from the source memory location to a register then the register to the destination memory location. – Michael Petch Oct 15 '20 at 15:10
  • 1
    PUSH/POP can move from memory to memory but they have one implicit argument (the stack). [MOVSB/MOVSW/MOVSD/MOVSQ](https://www.felixcloutier.com/x86/movs:movsb:movsw:movsd:movsq) can be used to move data but the SRC and DEST memory addresses are implicit as well ([ESI/RSI] to [EDI/RDI]) – Michael Petch Oct 15 '20 at 15:12

0 Answers0