I have a double word in the data section called pos.
If I execute push dword [pos] it will store the value of pos on the stack. But if I replace it with sub esp, 4; mov [esp], dword [pos] it won't work anymore. Why is push able to move a value from memory to memory and mov isn't?
            Asked
            
        
        
            Active
            
        
            Viewed 38 times
        
    0
            
            
        
        Some programmer dude
        
- 400,186
 - 35
 - 402
 - 621
 
        Vlad
        
- 59
 - 6
 
- 
                    1You can only encode one memory operand in the instruction format. And for push that's enough. – Bo Persson Nov 14 '17 at 18:52
 - 
                    2Because there is only place for one memory operand in the machine code. So at least one operand must be implicit. In case of `push` that's of course the `[esp]`. Also note there is the string move, `movsd` and friends, where both operands are implicit and those can also do memory to memory copy (it's their explicit purpose). – Jester Nov 14 '17 at 18:52