Saturday, December 4, 2021

simple program that calculate the sum of given array by using procedures in assembly language

include irvine32.inc

.386

.stack 4096

Exitprocess proto,dwExitcode:dword

.data

myarray dword 1,2,2,3,2,2

thesum dword ?

.code

main proc


call sumofarray

invoke Exitprocess,0

main endp


sumofarray proc

mov eax,0

mov esi,0

mov ecx,lengthof myarray

l1:

add eax,myarray[esi]

add esi,4

loop l1

mov thesum,eax

call WriteInt

ret

sumofarray endp


end main

 

No comments:

Post a Comment