Guest User

Untitled

a guest
Jun 10th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; multi-segment executable file template.
  2.  
  3. data segment
  4.     ; add your data here!
  5.     msg1 db "Inserisci 10 numeri:$"
  6.     msg2 db 13,10,"Il massimo e':$"
  7.     msg3 db 13,10,"Il minimo e':$"
  8.     vet db 10 dup (?)
  9.     min db ?
  10.     max db ?
  11.    
  12. ends
  13.  
  14. stack segment
  15.     dw   128  dup(0)
  16. ends
  17.  
  18. code segment
  19. start:
  20. ; set segment registers:
  21.     mov ax, data
  22.     mov ds, ax
  23.     mov es, ax
  24.    
  25.     xor ax,ax
  26.     xor cx,cx
  27.     mov cx,10
  28.     xor di,di
  29.    
  30.     lea dx,msg1
  31.     mov ah,9
  32.     int 21h
  33.    
  34. INSERIMENTO proc
  35.        
  36.        mov ah,1
  37.        int 21h
  38.        
  39.        mov vet[di],al
  40.        inc di
  41.        
  42.        loop INSERIMENTO
  43.        
  44. INSERIMENTO endp
  45.  
  46.   mini: xor ax,ax                                  
  47.         xor cx,cx
  48.         mov cx,10
  49.         mov si,di
  50.         xor si,si
  51.         mov al,vet[si]
  52.         mov min,al
  53.        
  54.         jmp RICERCAMIN
  55.            
  56.              
  57. RICERCAMIN proc
  58.     cmp cx,0
  59.     je stampamin
  60.     mov al,vet[si]
  61.     cmp al,min
  62.     jl aggiornamin
  63.     inc si
  64.    
  65.     loop RICERCAMIN
  66.    
  67.     jmp stampamin
  68.    
  69. RICERCAMIN endp
  70.  
  71.  
  72.  
  73.  aggiornamin:mov min,al
  74.              inc si
  75.              jmp RICERCAMIN
  76.              
  77.  stampamin: xor ax,ax
  78.            
  79.             lea dx,msg3
  80.             mov ah,9
  81.             int 21h
  82.            
  83.             mov al,min
  84.             mov ah,2
  85.             mov dl,al
  86.             int 21h
  87.                  
  88.  maxi:xor ax,ax
  89.       xor cx,cx
  90.       mov cx,10
  91.       xor si,si  
  92.       mov al,vet[si]
  93.       mov max,al                
  94.                  
  95.       jmp RICERCAMAX
  96.            
  97. RICERCAMAX proc
  98.    
  99.     cmp cx,0
  100.     je stampamax
  101.     mov al,vet[si]          
  102.     cmp al,max
  103.     jg aggiornamax
  104.     inc si
  105.    
  106.     loop RICERCAMAX
  107.    
  108.     jmp stampamax
  109.    
  110. RICERCAMAX endp
  111.  
  112.   aggiornamax: mov max,al
  113.                inc si
  114.                jmp RICERCAMAX
  115.                
  116.   stampamax: xor ax,ax
  117.              
  118.              lea dx,msg2
  119.              mov ah,9
  120.              int 21h
  121.              
  122.              mov al,max
  123.              mov ah,2
  124.              mov dl,al
  125.              int 21h
  126.              
  127.              jmp esci
  128.                            
  129.    
  130. esci:mov ax, 4c00h ; exit to operating system.
  131.      int 21h    
  132.      ends
  133.  
  134. end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment