Reversing an Array in Assembly (masm)
<p>I am trying to reverse an array in assembly but I am not being able to successfully do so. The program worked fine for double words but isn't working now for words. I checked it using the visual studio debugger. The final result is 98,78,10,00,36 which is wrong. My code is</p>

<pre><code>.386
.model flat,stdcall
ExitProcess PROTO,dwExitCode:DWORD
.data

intarray WORD 10h,20h,36h,78h,98h

.code
main PROC


mov esi,OFFSET intarray
mov edi,OFFSET intarray
add edi,SIZEOF intarray
sub edi,TYPE intarray
mov ecx,LENGTHOF intarray/2




L1:
mov eax,[ESI]
mov ebx,[EDI]
mov [EDI],eax
mov[ESI],ebx
add esi,TYPE intarray
sub edi,TYPE intarray
loop L1

invoke ExitProcess,0
main ENDP 
END main
</code></pre>