-1
   org 100h 
.model small
.data 
 var db ?
 msg db 10,13,'$' 

.code      
; add your code here
main proc
     mov ax,@data
     mov ds,ax

     mov ah,1 ;input 1st number
     int 21h
     sub al,48    
     mov var,al

     mov ah,1   ;input 2nd number
     int 21h
     sub al,48

     MUL var    ; multiplying two numbers
  
     sub al,48 ; going to ASCII value

     mov dl,al
     mov ah,2    ; printing result
     int 21h
      
     mov ah,4ch   
     int 21h
main endp
     end main
     ret
vitsoft
  • 5,515
  • 1
  • 18
  • 31
  • It is showing ASCII value of 12 if we multiply 3 and 4 how to get proper 12 digit in assembly lanuage 8086 emulator – AmirHassan May 09 '21 at 05:12

1 Answers1

1

You incorrectly mix two program models together. For MZ executable DOS program omit the first org 100h and the last ret. Or use the much simpler COM executable, which doesn't use segment-switching directives .data, .code, and you don;t have to bother with segment registers. Its skeleton looks like

     .model TINY
     org 100h
main proc
     ; Program code must start here at offset 100h
     ; The first machine instruction.
     ; Put your code here.

     ret      ; A simple ret terminates the COM program.
var db ?      ; Data variables follow the code section.
msg db 10,13,'$' 
    end main

When you multiplicate both digits with mul var, the product is in register AX and it may be in the range 0..65535. Only in special case, such as multiplaying 2 by 3 you will get result AX=6, which can be converted to a single-digit result by adding 48 to it (not by subtracting).

For methods how to convert unsigned 16bit integer to decimal digits search this site, there are lots of examples here.

vitsoft
  • 5,515
  • 1
  • 18
  • 31