
ExeciN
By: a guest on
May 14th, 2012 | syntax:
ASM (NASM) | size: 0.56 KB | hits: 15 | expires: Never
TITLE Array Sum
INCLUDE Irvine32.inc
.data
array1 dword 5Fh, 1337h, 3D4Bh, 1ACh
sum dword ?
.code
main PROC
mov ecx, LENGTHOF array1 ;setting the counter
mov eax, 0 ;initializing the register
L1: ;the loop starts here
add eax, [array1+ecx*4] ;adding a position of the array to eax
Loop L1 ;the loop ends here
add eax, array1 ;adding the first value of the array
; because the the loop ended on ecx=0
call writehex ;displaying the sum
exit
main ENDP
END main