.data
j SDWORD ?
k SDWORD ?
array1 SDWORD 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20
sum SDWORD ?
.code
_main PROC
mov j, 3 ; Setting J into the Array
mov k, 6 ; Setting K into the Array
mov edx, 2 ; Setting the index number for the starting position (J)
sumArray1:
mov eax, [array1+edx*4]
cmp eax, k
jg array2
add sum, eax
inc edx
jmp SumArray1
array2:
INVOKE ExitProcess, 0
_main ENDP
END
&sum is at a value of 12 when the program terms, meaning that for some reason it is not adding the value of K before jumping out of the loop. Any idea why?
