title: Finding factorial of a number in 8086 assembly
body: <p>Following is my code :</p>
  
  <pre><code>data segment
  num db 05h
  fact db 02h
  data ends
  code segment
  assume cs:code, ds:data
  start: mov dx,data
  mov ds,dx
  mov al,01h
  mov bl,num
  inc bl
  call prc
  prc proc
  imul fact
  inc fact
  cmp fact,bl
  jz endproc
  call prc
  endproc: mov fact,al
  ret
  prc endp
  mov ah,4ch
  int 21h
  code ends
  end start
  </code></pre>
  
  <p>I am aware that the program isn't correct. Here are the questions I have about this (I am trying to learn procedures) :</p>
  
  <ol>
  <li>To end a procedure, do we write directly <code>endp</code> <em>or</em> <code>[name] endp</code> (multiple books are giving me multiple answers)</li>
  <li>When it reaches the multiplication of 4*6, <code>imul</code> returns 18 in <code>AL</code>? How?</li>
  <li>After <code>ret</code> statement, the program jumps to the previous statement, not the statement after procedure end</li>
  </ol>
  
  <p>And help is appreciated!</p>