Search code examples
assemblyreverse-engineeringmasm

Difference between push myVar , push [myVar] and push OFFSET myVar


I am new to assembly and I'm using MASM. I see these lines of code and wonder what's the difference between

a) push myVar

b) push [myVar]

c) push OFFSET myVar

How do I know if they are pushing the value or the address of myVar Thanks!

Best regards, Thanks


Solution

  • push myVar is simply pushing your var on the stack.

    push [myVar] is dereferencing your var. if myVar is a pointer, this code will push the value at the address on the stack.

    I'm not sure for the last one, but it seems it does the inverse, push OFFSET myVar is pushing the address of myVar on the stack.