Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; multi-segment executable file template.
- data segment
- ; add your data here!
- msg1 db "Inserisci 10 numeri:$"
- msg2 db 13,10,"Il massimo e':$"
- msg3 db 13,10,"Il minimo e':$"
- vet db 10 dup (?)
- min db ?
- max db ?
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- xor ax,ax
- xor cx,cx
- mov cx,10
- xor di,di
- lea dx,msg1
- mov ah,9
- int 21h
- INSERIMENTO proc
- mov ah,1
- int 21h
- mov vet[di],al
- inc di
- loop INSERIMENTO
- INSERIMENTO endp
- mini: xor ax,ax
- xor cx,cx
- mov cx,10
- mov si,di
- xor si,si
- mov al,vet[si]
- mov min,al
- jmp RICERCAMIN
- RICERCAMIN proc
- cmp cx,0
- je stampamin
- mov al,vet[si]
- cmp al,min
- jl aggiornamin
- inc si
- loop RICERCAMIN
- jmp stampamin
- RICERCAMIN endp
- aggiornamin:mov min,al
- inc si
- jmp RICERCAMIN
- stampamin: xor ax,ax
- lea dx,msg3
- mov ah,9
- int 21h
- mov al,min
- mov ah,2
- mov dl,al
- int 21h
- maxi:xor ax,ax
- xor cx,cx
- mov cx,10
- xor si,si
- mov al,vet[si]
- mov max,al
- jmp RICERCAMAX
- RICERCAMAX proc
- cmp cx,0
- je stampamax
- mov al,vet[si]
- cmp al,max
- jg aggiornamax
- inc si
- loop RICERCAMAX
- jmp stampamax
- RICERCAMAX endp
- aggiornamax: mov max,al
- inc si
- jmp RICERCAMAX
- stampamax: xor ax,ax
- lea dx,msg2
- mov ah,9
- int 21h
- mov al,max
- mov ah,2
- mov dl,al
- int 21h
- jmp esci
- esci: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