Guest User

Untitled

a guest
Jun 10th, 2018
161
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 "Digita 10 numeri:$"
  6.     msg2 db 13,10,"I numeri ordinati:$"
  7.     vet db 10 dup (?)
  8.     ;veto db 10 dup (?)
  9.     ;n db ?
  10.    
  11. ends
  12.  
  13. stack segment
  14.     dw   100h  dup(0)
  15. ends
  16.  
  17. code segment
  18. start:
  19. ; set segment registers:
  20.     mov ax, data
  21.     mov ds, ax
  22.     mov es, ax
  23.    
  24.     xor ax,ax
  25.     xor cx,cx
  26.     mov cx,10
  27.     xor si,si
  28.    
  29.     lea dx,msg1
  30.     mov ah,9
  31.     int 21h
  32.    
  33. inserimento:mov ah,1
  34.             int 21h
  35.             mov vet[si],al
  36.             inc si
  37.             loop inserimento
  38.              
  39.             xor di,di
  40.             xor si,si
  41.             mov cx,9
  42.            
  43.             lea dx,msg2
  44.             mov ah,9
  45.             int 21h
  46.  
  47. ordinamento:mov si,di
  48.             inc si
  49.              
  50.            
  51. for1:       cmp si,10
  52.             jnb finefor1
  53.             mov ah,vet[si]
  54.            
  55. for2:       cmp ah,vet[di]
  56.             jnb finefor2
  57.             mov dh,vet[si]
  58.             mov dl,vet[di]
  59.             mov vet[si],dl
  60.             mov vet[di],dh
  61.            
  62. finefor2:   nop
  63.             inc si
  64.             jmp for1
  65.            
  66. finefor1:   nop
  67.             inc di
  68.             loop ordinamento
  69.            
  70.             xor si,si
  71.             mov cx,10    
  72.  
  73. stampa:     mov ah,2
  74.             mov dl,vet[si]
  75.             int 21h
  76.             inc si
  77.             loop stampa    
  78.              
  79.             jmp esci
  80.    
  81. esci: mov ax, 4c00h ; exit to operating system.
  82.       int 21h    
  83.       ends
  84.  
  85. end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment