title: Print from 1 to < user input in emu8086
body: <p>I want to get a number (i.e 5) from the user and then print starting from 1 to &lt; input (i.e  1 2 3 4) 
  But my code does not stop in "4" rather than the loop runs till "d"</p>
  
  <p>I know that loop runs CX times
  and as in 8086 MOVZX does not work that is why at first I moved AL to CL then zeroed the CH.</p>
  
  <p>As someone mentioned that the problem is as I am moving AL to CX I'm not moving the value 4, I'm moving 34(ASCII value of 4) and so my loop runs 34 times.</p>
  
  <p>Now how do I convert my user input value to decimal and move that to CX. Is there any way to take user input that will be stored in AL as decimal value?  </p>
  
  <pre><code>org 100h
  
  
  
  
  MOV AH, 1  ; Get user input 
  INT 21H
  
  
  DEC AL ; Dec AL to satisfy the condition that it will print till &lt; input
  
  MOV BL,31H ; Initialize BL so that the output starts printing from 1 
  
  MOV CL,Al ; set counter register CX 
  MOV CH,00
  
  
  Print:
  
  MOV AH, 2    ; for output printing
  MOV DL,0DH  ; for output printing
  INT 21H      ; for output printing
  
  MOV DL,0AH      ; for output printing
  INT 21H            ; for output printing
  
  MOV AH,2
  MOV DL,BL         ; print what is in BL 
  INT 21H
  
  INC BL             ; then increment BL
  
  LOOP Print     ; supposed to run the loop on Print what is the value in CL times
  
  hlt
  </code></pre>