Using an x64 assembler to reference memory

242 views Asked by At

I'm using this assembler: https://defuse.ca/online-x86-assembler.htm#disassembly

Does anyone know how to encode a memory operand? Say for example this ADD on page 457 of the intel x64 manual: ADD r/m8, imm8. I would have thought it'd be like 'ADD 0x1122334455667788, 0x01' but it says "Error: operand type mismatch for `add'"

1

There are 1 answers

7
Alex Reece On BEST ANSWER

In the Intel assembly syntax, you need to use square brackets to denote that you are referencing the value at a memory address and also include the size information.

ADD DWORD PTR [0x11223344], 0x55

See "Addressing Memory" and "Size Directives" of https://www.cs.virginia.edu/~evans/cs216/guides/x86.html#memory for more information.

-- edit: fix answer to acknowledge it is possible to access memory directly.