Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- stack 256h
- .data
- enter_str db 'Enter string:$'
- invite db '> $'
- max_str db 'Maximum number: $'
- min_str db 'Minimum number: $'
- string db 255, ?, 255 dup(?)
- error db 'No numbers in string$'
- new_line db 10,13,'$'
- max db 0
- min db 10
- .code
- write macro string
- push ax
- push dx
- mov ah,09h
- mov dx,offset string
- int 21h
- pop dx
- pop ax
- endm
- start:
- mov ax,@data
- mov ds,ax
- write enter_str
- write new_line
- mov dx,offset string
- mov ah,0Ah
- int 21h
- mov bx,2
- xor ch,ch
- mov cl,string[1]
- cmp cx,0
- je er
- find_max_min:
- mov al,string[bx]
- cmp al,'0'
- jl continue_2
- cmp al,'9'
- jg continue_2
- sub al,'0'
- cmp al,max
- jl continue
- mov max,al
- continue:
- cmp al,min
- jg continue_2
- mov min,al
- continue_2:
- inc bx
- loop find_max_min
- er:
- cmp min,10
- jne print_nums
- write new_line
- write error
- jmp quit
- print_nums:
- write new_line
- write max_str
- mov ah,02h
- mov dl,max
- add dl,'0'
- int 21h
- write new_line
- write min_str
- mov ah,02h
- mov dl,min
- add dl,'0'
- int 21h
- quit:
- push ax
- mov ah,10h
- int 16h
- pop ax
- mov al,0
- mov ah,4Ch
- int 21h
- End start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement