title: Intel 8086 - Program Locks Up After Entering a Number
body: <p>I'm really new to Assembly Language and I'm working on an assignment that is suppose to ask you to enter a number, either until you type in a zero or until you type in nine numbers, store them on the stack, and then add up the numbers when you're done inputting numbers, and print the sum to the screen. When I assemble and tlink the program and its external files, it does not come up with any errors; however, when I run the code, it prints a blank line (and nothing else), lets me enter one number, locks up, and closes DOSBox. I've been trying to figure out what's wrong and how to fix it, but I'm completely stuck. Any help would be appreciated, thank you!</p>
  <pre><code>.model small
  .stack 100h
  .data
      count db 0
      sum dw 0
      prompt db 0ah, 0dh, 'Enter Value ', '$'
      colon db ': ','$'
      reply db 0ah, 0dh, 'Sum Equals: ', '$'
  .code
      extrn indec: proc
      extrn outdec: proc
      include myMacros.asm
  
      mov ax,@data
      mov ds,ax
  
      mov cx,0
      mov bx,0
      
      push cx
      ;jmp L1
      
  L1:
      inc count
      prtStr prompt
      mov cl,count
      writeCh count
      prtStr colon
      call indec
      cmp ax,0
      je S
      push ax
      cmp cx,9
      jl L1
      
  S:
      pop dx
      add bx,dx
      cmp dx,0
      jne S
  
      ;prtStr reply
      mov ax,bx
      call outdec
      exit
      
  endp
      
  end
  </code></pre>