title: ASM to push function arguments to the stack
body: <p>I'm trying to port a program to x64 using vs2008. The problem is, however, that the is some inline asm code that is not supported on x64. This asm code is used to push arguments with unknown type or number to functions from dll. It is an interpeter based program in which you can specify a function to use from a certain dll and the program pushes the arguments and calles the function at compile time.</p>
  
  <p>Using various sources I've concluded that generating seperate .asm files that contain asm functions which can be compiled unsing masm and their obj files linked to vs2008. Using different files for x86 and x64 the program builds for both problems. The problem is however, that the functions do not replicate what the inline asm is doing.</p>
  
  <p>I converted the following inline code, for example:</p>
  
  <pre><code>double a = Evaluate(arg[i]).num;
  _asm  push a  + 4 
  _asm  push a
  j += 8;
  </code></pre>
  
  <p>To:</p>
  
  <pre><code>double a = Evaluate(arg[i]).num;
  EvaluateFuncArgFloat(a);
  j += 8;
  </code></pre>
  
  <p>With the follwoing .asm file:</p>
  
  <pre><code>TITLE EvaluateFuncArgFloat                      (evaluate_asm.asm)
  
  .386
  .model flat, C
  
  .code
  EvaluateFuncArgFloat PROC a:DWORD
  
          push    a + 4
          push    a
          ret
  
  EvaluateFuncArgFloat ENDP
  
  END
  </code></pre>
  
  <p>This does not do what I'm expecting. The double simply does not end up in the function as it did when using inline asm.</p>
  
  <p>My guess is that there is a small error or something I've left out, but after many tries I can't seem to get it to work. Hopefully someone can help me with this problem, it is very much appriciated.</p>