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 2volte invio 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 bx,15
  30.     mov si,0
  31.     inserimento:mov ah, 1          ;richiede inserimento di un numero
  32.                 int 21h
  33.                 cmp bx,010          ;confronto con l'accapo
  34.                 je stampa            ;se e' uguale salta a stampa
  35.                 mov cognome[si],al    ;se non lo e' copia l'elemento inserito nel vettore
  36.                 cmp cognome[si],010
  37.                 je stampa
  38.                 inc si                 ;incrementa il contatore
  39.                 dec bx                  ;decrementa il massimo numero di elementi da inserire (max 15)
  40.                 jmp inserimento  
  41.                
  42.     stampa: mov cognome[si], '$'       ;procedura per la stampa del vettore
  43.             int 21h              
  44.             lea dx,accapo
  45.             mov ah,9
  46.             int 21h
  47.             lea dx, msg1
  48.             mov ah, 9
  49.             int 21h    
  50.             lea dx,cognome
  51.             mov ah,9
  52.             int 21h
  53.        
  54.                
  55.            
  56.     lea dx, pkey
  57.     mov ah, 9
  58.     int 21h        ; output string at ds:dx
  59.    
  60.     ; wait for any key....    
  61.     mov ah, 1
  62.     int 21h
  63.    
  64.     mov ax, 4c00h ; exit to operating system.
  65.     int 21h    
  66. ends
  67.  
  68. end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment