TITLE Swap Procedure Example (Swap.asm)
INCLUDE Irvine32.inc
INCLUDELIB Irvine32.lib
INCLUDELIB user32.lib
INCLUDELIB kernel32.lib
INCLUDE Macros.inc
Swap PROTO,
pValX:PTR DWORD,
pValY:PTR DWORD
.data
Array DWORD 10000h,20000h
.code
main PROC
mov esi,OFFSET Array
mov ecx,2
mov ebx,TYPE Array
call DumpMem
INVOKE Swap,ADDR Array, ADDR [Array+4]
call DumpMem
exit
main ENDP
Swap PROC USES eax esi edi,
pValX:PTR DWORD,
pValY:PTR DWORD,
LOCAL VAR1:DWORD
mov esi,pValX ; get pointers
mov edi,pValY
MOV EAX,VAR1
mov eax,[esi] ; get first integer
xchg eax,[edi] ; exchange with second
mov [esi],eax ; replace first integer
ret
Swap ENDP
END main
上面是程序,我只在SWAP中添加一个局部变量VAR1,编译错误提示如下,问题出在哪,求帮忙。。
------解决方案--------------------
你的局部变量用来做啥了!没看明白呢!