I need some assistance in my program: I suppose to select an array size:
array_size = 20
array dword array_size dup(?)
And, create a new procedure that prompts the user for the number of integers to be processed, and pass the same value to the promptForIntegers procedure.
How many integers will be added? 5
My problems is that my counter continue to iterates infinite times, and my question is how and where do I take the user input above (5) and pass the counter and (5) to procedure promptForIntegers?
INCLUDE Irvine32.inc
array_size = 10
.data
prompt1 byte "How many integers will be added?", 0
prompt2 byte "Enter a signed integer: ", 0
prompt3 byte "The sum of the integers is: ", 0
array dword array_size dup(?)
.code
main proc
call clrscr
mov ecx,eax
call promptMes
call arraysum
call displaysum
exit
main endp
promptMes proc uses ecx edx esi
mov edx,offset prompt1
mov esi,offset array
call writestring
call readint
call crlf
call promptforintegers
ret
promptMes endp
promptforintegers proc uses ecx edx esi
mov edx,offset prompt2
l1: call writestring
call readint
call crlf
mov [esi], ax
add esi,type word
loop l1
ret
promptforintegers endp
arraysum proc uses esi ecx
mov eax, 0
l1: add eax,[esi]
add esi,type dword
loop l1
ret
arraysum endp
mov edx, offset prompt3
call writestring
call writeint
call crlf
ret
displaysum endp
end main