我有两项任务:
ar2长度ar1移动到ar2,将每个项递增1我需要汇编语言x86 Irvine32的帮助。我必须做上述两件事。我得到了第一个正确的,但我有点迷失在第二个。你是怎么做到的?到目前为止,我的情况如下:
INCLUDE Irvine32.inc
.data
ar1 WORD 1,2,3
ar2 DWORD 3 DUP(?)
.code
main PROC
mov eax, 0
mov eax, LENGTHOF ar2
mov bx, ar1
mov ebx, ar2
inc ebx
call DumpRegs
exit
main ENDP
END main发布于 2016-02-26 19:22:36
您只需从第一个数组中读取单词(每个条目的大小为2),并将它们复制到包含DWORD的第二个数组中(每个项的大小为4):
主要程序
mov ecx, LENGTHOF ar2 ; ECX should result in '3'
lea esi, ar1 ; source array - load effective address of ar1
lea edi, ar2 ; destination array - load effective address of ar2
loopECX:
movzx eax, word ptr [esi] ; copies a 16 bit memory location to a 32 bit register extended with zeroes
inc eax ; increases that reg by one
mov dword ptr [edi], eax ; copy the result to a 4 byte memory location
add esi, 2 ; increases WORD array 'ar1' by item size 2
add edi, 4 ; increases DWORD array 'ar2' by item size 4
dec ecx ; decreases item count(ECX)
jnz loopECX ; if item count(ECX) equals zero, pass through
; and ...
call DumpRegs ; ... DumpRegs
exit
main ENDP
END mainhttps://stackoverflow.com/questions/35659043
复制相似问题