Guest User

Untitled

a guest
Jun 17th, 2018
89
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.         msg db "Inserire il cognome e premi spazio per terminare!",10,13,"$"    ;messaggi vari
  6.         accapo db 10,13,"$"
  7.         cognome db 15 dup(?)    ;dichiarazione vettore
  8.         pkey db "press any key...$"  
  9.         msg1 db "hai inserito il cognome $"
  10.     ends
  11.      
  12.     stack segment
  13.         dw   128  dup(0)
  14.     ends
  15.      
  16.     code segment
  17.     start:
  18.     ; set segment registers:
  19.         mov ax, data
  20.         mov ds, ax
  21.         mov es, ax
  22.      
  23.         ; add your code here
  24.        
  25.         lea dx,msg            ;metodo x stampare un messaggio
  26.         mov ah,9
  27.         int 21h  
  28.        
  29.         mov si,0
  30.         inserimento:mov ah, 1          ;richiede inserimento di un numero
  31.                     int 21h            
  32.                     cmp al,' '           ;se e' uguale salta a stampa
  33.                     je fine_inserimento
  34.                     mov cognome[si],al  
  35.                     inc si                 ;incrementa il contatore
  36.                     jmp inserimento  
  37.        
  38.         fine_inserimento:    
  39.              
  40.         lea dx,msg1
  41.         mov ah,9
  42.         int 21h
  43.              
  44.         xor bx,bx
  45.         xor dx,dx  
  46.                      
  47.         stampa:
  48.                 cmp si,0
  49.                 je fine
  50.                 mov dl,cognome[bx],
  51.                 mov ah,2     ;procedura per la stampa del vettore
  52.                 int 21h
  53.                 dec si
  54.                 inc bx
  55.                 jmp stampa    
  56.                
  57.                
  58.         fine:          
  59.                
  60.         lea dx, pkey
  61.         mov ah, 9
  62.         int 21h        ; output string at ds:dx
  63.        
  64.         ; wait for any key....    
  65.         mov ah, 1
  66.         int 21h
  67.        
  68.         mov ax, 4c00h ; exit to operating system.
  69.         int 21h    
  70.     ends
  71.      
  72.     end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment