Nou*_*ain -1 arrays assembly masm irvine32
以下是我在汇编中的代码,将源数组的内容复制到目标数组.但似乎源数组的所有内容都没有复制到目标数组.请帮忙.
INCLUDE Irvine32.inc
.data
mess1 byte "YOUR ARRAY IS:",0
mess2 byte "COPIED Array is:",0
source byte "YOU Have to work hard to score a 4",0
target byte sizeof source dup(0)
.code
main PROC
call clrscr
call crlf
mov edx,offset mess1
call writestring
call crlf
mov edx,offset source
call writestring
call crlf
call crlf
mov ecx,sizeof source
L1:
mov esi,0
mov al,source[esi]
mov target[esi],al
inc esi
loop L1
mov edx,offset mess2
call writestring
call crlf
mov edx,offset target
call writestring
exit
main ENDP
END main
Run Code Online (Sandbox Code Playgroud)
OUTPUT:
移动MOV ESI,0圈外在这部分代码
call crlf
call crlf
mov ecx,sizeof source
L1:
mov esi,0 ; <-- move one line up
mov al,source[esi]
mov target[esi],al
inc esi
loop L1
Run Code Online (Sandbox Code Playgroud)
应该是这样的
call crlf
call crlf
mov ecx,sizeof source
mov esi,0
L1:
mov al,source[esi]
mov target[esi],al
inc esi
loop L1
Run Code Online (Sandbox Code Playgroud)
否则你ESI在每个循环中重置为零,使得INC ESI无用.