include irvine32.inc
chang proto ,v1:ptr dword,v2: ptr dword
.data
i dword ?
j dword ?
str1 byte "交换前的是:",0;
str2 byte "交换后的结果:",0;
.code
main proc
call readint
mov i,eax;
call readint
mov j,eax;
mov edx,offset str1
call writestring;
mov eax,i;
call writeint;
mov al,','
call writechar
mov eax,j
call writeint;
call crlf;
invoke chang,offset i,offset j;
mov edx,offset str1
call writestring;
mov eax,i;
call writeint;
mov al,','
call writechar
mov eax,j
call writeint;
call crlf;
exit
main endp
chang proc,
v1:ptr dword,
v2:ptr dword
mov eax,v2;
mov esi,v1;
mov ebx,[eax];
xchg ebx,[esi];
mov [eax],ebx;
ret;
chang endp
end main