title: readint function help... ?(MASM)
body: <p>I'm trying to complete a MASM program. This is my goal (my homework).</p>
  
  <p>Modify the Summation program in Section 5.6.1 (pages 173-175) as follows: Select an array size using a constant:</p>
  
  <p>ARRAY_SIZE = 20</p>
  
  <p>array DWORD ARRAY_SIZE DUP(?)</p>
  
  <p>Write a new procedure that prompts the user for the number of integers to be processed.  Pass the same to the PromptForIntegers procedure. For example,</p>
  
  <p>How many integers will be added? 5</p>
  
  <pre><code>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
  </code></pre>
  
  <p>My problems are that my counter continues 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?</p>
  
  <p>I saw the <a href="https://www.daniweb.com/software-development/assembly/threads/396080/procedure" rel="nofollow noreferrer">same question</a> online, and this is the reply that they got.</p>
  
  <blockquote>
    <p>where is the function readint ?</p>
    
    <p>How is ecx set to the number of integers that the user wants? Maybe
    its set in readint?</p>
  </blockquote>
  
  <p>However, they did not show the source of the code complete. And I do not know how to modify my code using the readint. Can anyone tell me how this will look like with the readint function?</p>