字符串的复制srcmsg---dstmsg

2014-11-24 10:18:10 · 作者: · 浏览: 0

中午练习:


[cpp]
include io32.inc
.data
srcmsg byte 'This is a loop copy.',0
dstmsg byte sizeof srcmsg dup( )
.code
start:
mov ecx,lengthof srcmsg

mov esi,offset srcmsg
mov edi,offset dstmsg
again:
mov al,[esi]
mov [edi],al
inc esi
inc edi
loop again
mov eax,offset dstmsg
call dispmsg
exit 0
end start

[cpp]
include io32.inc
.data
srcmsg byte 'This is a loop copy.',0
dstmsg byte sizeof srcmsg dup( )
.code
start:
mov ecx,lengthof srcmsg
mov ebx,0
again:
mov al,srcmsg[ebx]
mov dstmsg[ebx],al
inc ebx
loop again
mov eax,offset dstmsg
call dispmsg
exit 0
end start