title: MASM how to make desired function call
body: <p>I'd like to know, how to do the following.
  I have an array, where i have to summ numbers (easy)
  but the twist is, that i have to have a function call for it, 
  that get's  is params through specific registers. How do i implement that?
  In this case, the function needs to get the array (offset) through ESI, and the length of it through ECX.
  please educate me
  EDIT:
  in the meantime i've conjured up this. No idea if this works to as my MASM compliling just broken itself for no reason</p>
  
  <pre><code>.data
  intarray DWORD 10000h,20000h,30000h,40000h
  
  .code
  
  szummer proc uses esi ecx,
      ptrArray:PTR DWORD, ;points to the array
      szArray: Dword      ;array size
      mov esi, ptrArray ;address of the array
      mov ecx, szArray  ;szize
      mov eax, 0    ;set to 0
  AS1:
      add eax, [esi] ;add each int to sum
      add esi, 4  ;point to next int
      loop AS1    ;reapet for array size
  
  
  ret;
  szummer endp
  
  main proc
  mov ecx, OFFSET intarray
  mov esi, LENGHTOF intarray
  INVOKE ArraySum,ecx,esi                     
  
  invoke ExitProcess,0
  main endp
  end main
  </code></pre>