Advertisement
shabbyheart

Microprocessor lab 4

Dec 16th, 2019
1,863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ; You may customize this and other start-up templates;
  3. ; The location of this template is c:\emu8086\inc\0_com_template.txt
  4.  
  5. org 100h
  6.  
  7. .data
  8.     A db 1,2,3,4,5,6,7,8,9
  9.     B db 0
  10.     message db 'Enter the value of N: $'
  11. .code
  12.     main proc
  13.         mov ax,@data
  14.         mov ds,ax
  15.        
  16.         xor ax,ax
  17.         xor cx,cx
  18.         mov si,offset A
  19.         mov di,offset B
  20.         mov dx,offset message
  21.        
  22.         mov ah,09
  23.         int 21h  
  24.        
  25.         mov ah,01h
  26.         int 21h
  27.         mov cl,al
  28.         sub cl,48
  29.         xor al,al
  30.        
  31.         xor bl,bl
  32.        
  33.         loop_1:
  34.             mov al,[si]
  35.             mul al
  36.            
  37.             add bl,al
  38.             inc si
  39.             loop loop_1
  40.          
  41.        
  42.         mov ah,02h
  43.         mov dl,13
  44.         int 21h
  45.         mov dl,10
  46.         int 21h
  47.        
  48.          
  49.          
  50.         xor ah,ah
  51.         mov al,bl
  52.         mov bl,10
  53.         div bl
  54.        
  55.         mov bl,ah
  56.         mov dl,al
  57.         add dl,48
  58.         mov ah,02h
  59.         int 21h
  60.        
  61.         mov dl,bl
  62.         add dl,48
  63.         mov ah,02h
  64.         int 21h
  65.          
  66.            
  67.        
  68.        
  69.     main endp
  70.     end main
  71.  
  72. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement