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

where is the function readint ?

How is ecx set to the number of integers that the user wants? Maybe its set in readint?

Thanks, I got it operating! Now,I want to use a conditional structure to validate their entry. Like this, when the user enter a number greater than n , I will display a error message and then I will allow them n time retry before the program ends. I sorry about this but my instructor did not lecture on this at all (final time)... intro to assembly language... Thanks for you prompt responds...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.