在数组中添加(在MASM汇编语言中)

时间:2018-03-21 22:31:08

标签: assembly masm 32-bit

我有一个实验室项目,在数组中添加5个数字,大小为WORD。我以为我正确地做了,但我错过了一些东西(逻辑上也是如此)。

INCLUDE Irvine32.inc

.data
    intarray DWORD 5,6,7,8,9    ; Declares a WORD array with 1,2,3,4,5
    intsum DWORD 0          ; where I want the answer to go (Total should be 35)

.code
main PROC

    MOV eax, intarray   ; EAX = intarray
    MOV ecx, intsum     ; ECX = 0
    L1:
    add eax, ecx
    loop L1

    CALL DumpRegs           
    MOV edi, OFFSET intarray    
    MOV ebx, SIZEOF intarray
    MOV ecx, 1          
    CALL DumpMem        
    CALL WriteINT

    exit

main ENDP
END main

该程序运行但它没有给我正确的答案。它应该显示35但我感觉我不包括整个阵列。有人可以帮助我吗?

0 个答案:

没有答案
相关问题