title: Printing star triangle in assembly
body: <p>I'm trying to print a triangle like this: <a href="https://i.stack.imgur.com/Tj1jp.png" rel="nofollow noreferrer">in assembly</a>.
  The formula to find the number of stars in each row is: 2 * x + 1.
  Here is my code so far. I seem to be looping infinitely.</p>
  
  <pre><code>.data
  prompt BYTE "Please enter the number of rows in the pyramid: ", 0
  numRows DWORD ?
  count DWORD 0
  
  .code
  main PROC
      mov edx, OFFSET prompt
      call WriteString
      call ReadInt
  
      mov numRows,eax                         
      mov ecx,numRows + 1                 ; Let ecx = numRows + 1
  L1:
      inc count                           ; Increment count
      mov eax,ecx
  
      L2:
          sub eax,count                   ; eax = eax - count
          mov al, ' '                     ; Print spaces
          call WriteChar
          loop L2
      L3:
          mov ebx,count                   ; ebx = count
          add ebx,count                   ; ebx = ebx + count
          sub ebx,1                       ; 2x - 1
          mov al, '*'                     ; Printing the star pattern
          call WriteChar
          loop L3
  
      call CrLf
      loop L1
  
  exit
  main ENDP
  END main
  </code></pre>
  
  <p>Where am I going wrong?</p>