Is there an x86 opcode for moving an immediate byte to a direct memory location (without using registers)?

Nicholas Hill picture Nicholas Hill · Sep 13, 2011 · Viewed 8.9k times · Source

Is there a way to 'mov'e a specific immediate byte-size number into a direct memory location? I.e.

MOV 10h,ffffh

to write the value 16 into the memory address 65535? If so, which opcode is that, orwould I have to store a memory address into a register first?

Answer

Stephen Canon picture Stephen Canon · Sep 13, 2011

Yes. The opcode is C6. You should download a copy of the Intel ISA documents, which are freely available.

To your follow-up question: the full encoding of your example is:

  c6      04      25   ff ff 00 00   10
opcode  modr/m   sib     address     immediate