Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; multi-segment executable file template.
- data segment
- ; add your data here!
- msg db "Inserire il cognome e premi 2volte invio per terminare!",10,13,"$" ;messaggi vari
- accapo db 10,13,"$"
- cognome db 15 dup(?) ;dichiarazione vettore
- pkey db "press any key...$"
- msg1 db "hai inserito il cognome $"
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- ; add your code here
- lea dx,msg ;metodo x stampare un messaggio
- mov ah,9
- int 21h
- mov bx,15
- mov si,0
- inserimento:mov ah, 1 ;richiede inserimento di un numero
- int 21h
- cmp bx,010 ;confronto con l'accapo
- je stampa ;se e' uguale salta a stampa
- mov cognome[si],al ;se non lo e' copia l'elemento inserito nel vettore
- cmp cognome[si],010
- je stampa
- inc si ;incrementa il contatore
- dec bx ;decrementa il massimo numero di elementi da inserire (max 15)
- jmp inserimento
- stampa: mov cognome[si], '$' ;procedura per la stampa del vettore
- int 21h
- lea dx,accapo
- mov ah,9
- int 21h
- lea dx, msg1
- mov ah, 9
- int 21h
- lea dx,cognome
- mov ah,9
- int 21h
- lea dx, pkey
- mov ah, 9
- int 21h ; output string at ds:dx
- ; wait for any key....
- mov ah, 1
- int 21h
- mov ax, 4c00h ; exit to operating system.
- int 21h
- ends
- end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment