title: I am beginner in assembly language programming, unable to find out negative numbers in given array
body: <p>Question regarding Assembly Language Programming (using Masm Irvine32 Library).</p>
  
  <p>I am trying to check and count negative numbers in the given array:</p>
  
  <pre><code>arrayW:  3, -2, 5, 7, 2, 9, -11, 32, -19, 18, 17, 15, -5, 2, 3, 1, -21, 27,-29, 20, 
  </code></pre>
  
  <p>In the output the number that is displayed will be 6 because there are 6 negative elements in arrayW, namely:</p>
  
  <pre><code> -2, -11, -19, -5, -21, -29.
  </code></pre>
  
  <p>Here I have tried a code which is calculating numbers between (-2, 17) in the given array, but unable to understand how to code to check and count negative elements is given array, can anyone please help me here</p>
  
  <pre><code>INCLUDE Irvine32.inc
  .DATA
  arrayW SDWORD 3, -2, 5, 7, 2, 9, -11, 32, -19, 18, 17, 15, -5, 2, 3, 1, -21, 27,-29, 20
  initVal SDWORD -2
  finalVal SDWORD 17
  finalCount SDWORD ?
  
  .CODE
  between PROC
  cmp eax,ebx                 
  jg next3                    ; if eax&gt;ebx, 0&lt;-EAX
  cmp ebx,ecx
  jg next3                    ; if ebx&gt;ecx, 0&lt;-EAX
  mov eax,1                   ; 1 in EAX register if eax&lt;=ebx and ebx&lt;=eax
  jmp next4
  next3:
  mov eax,0                   ; if (eax&lt;=ebx and ebx&lt;=ecx) evaluates to false, 
  then 0&lt;-EAX
  next4:
  ;call DumpRegs              ;Display the register contents
  ret
  between ENDP
  main PROC
  mov edi, 0
  mov ecx, LENGTHOF arrayW
  mov edx,0                   ;EDX will hold the count of the elements in the array in the range [-2,17]
  L1:
  push ecx                    ;push the contents of counter register ecx to 
  stack
  
  mov eax, initVal            ;the element in the array should be &lt;= -2
  mov ebx,arrayW[edi]         ;move the element in the array to ebx
  mov ecx, finalVal           ;the element in the array should be &lt;= 17
  call between                ;between proc call 
  add edx,eax                 ;if the element is in the range [-2,17], add 1 to 
  EDX
  add edi,TYPE arrayW         ;add 4 to edi to move to the next element
  pop ecx                     ;pop the value of counter register 
  loop L1                     ;repeat the above for all the elements in the 
  array (until ecx is 0)
  mov eax,edx                 ;Move the count to eax register
  call WriteInt               ;To display the output in decimal format
  ;call DumpRegs              ;Display the register contents              
  
  exit
  main ENDP
  END main
  </code></pre>