title: Multiplication, Division, Substraction and Addition in same Assembly Language Program
body: <p>Does anyone knows how can one perform all four mathematical operations (Multiplication, Division, Substraction and Addition) in a single program for 8 BIT/16 BIT operands. I am able to perform maximum three programs using AL,BL,CL,DL registers but i am unable to understand where should i store the values afterwards because AL is required for both DIV,MUL operations.</p>
  
  <p>All efforts shall be appreciated if anyone could come up with a simple program or logic at least.</p>
  
  <p>Code:</p>
  
  <pre><code>;================== Header ==================
  ; File:         all.asm
  ; Author:       Anurag Shukla
  ; Date:         25/02/2013
  ;================== Directives ==================
  
  [BITS 16H]
  [ORG 100H]
  
  ;================== Code Segment ==================
  [SECTION .text]
  
  mov al,0
  mov bl,0
  mov cl,0
  mov dl,0
  mov si,0
  mov di,0
  ;================== Addition 
  mov bp, 10H
  add bp, [NUMADD]
  daa
  
  mov di, 20H
  sub di, [NUMSUB]
  das
  
  mov al, 10H
  mov bl, 10H
  mul bl
  mov [RMUL],al
  mov dl,[RMUL]
  
  mov al, 10H
  mov bl, 2H
  div bl
  
  
  int3
  
  
  [SECTION .DATA]
  
  NUMADD: DB 10H
  NUMSUB: DB 10H
  RSUB: DB 0H
  RSUM: DB 0H
  RMUL: DB 0H
  RDIV: DB 0H
  </code></pre>