Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DATA SEGMENT
- BUF DB 29 dup (?)
- MINIM DB 0
- MAXIM DB 0
- LS50 DB 30 dup (0)
- AB50 DB 30 dup (0)
- PRBUF DB 'BUF: $'
- PRMIN DB 'MIN: $'
- PRMAX DB 'MAX: $'
- PRAB DB 'AB50: $'
- PRLS DB 'LS50: $'
- DATA ENDS
- CODE SEGMENT
- ASSUME CS:CODE,DS:DATA
- flmas proc
- mov al,[bx+29]
- inc ax
- mov [bx+29],al
- dec ax
- add bx,ax
- mov [bx],dl
- ret
- flmas endp
- printmas proc
- push bx
- push dx
- xor cx,cx
- mov bx,10
- oi2:
- xor dx,dx
- div bx
- push dx
- inc cx
- cmp ax,0
- jne oi2
- mov ah,02h
- lip:
- pop dx
- add dx,30h
- int 21h
- loop lip
- mov dx,20h
- int 21h
- pop dx
- pop bx
- ret
- printmas endp
- printmaxmin proc
- xor ax,ax
- mov al,[bx]
- call printmas
- ret
- printmaxmin endp
- start:
- mov ax,data
- mov ds,ax
- mov dx,offset PRBUF
- mov ah,9h
- int 21h
- mov si,1
- mov cx,29
- lp:
- mov ax,si
- mov dl,5
- mul dl
- push ax
- mov ax,si
- mov dl,3
- div dl
- pop dx
- add dl,al
- cmp dx,50
- jl ls
- mov ax,50
- jmp endls
- ls:
- mov ax,dx
- mov dx,50
- endls:
- mov bx,offset BUF
- add bx,si
- dec bx
- sub dx,ax
- mov [bx],dl
- ;fill new massive
- cmp dl,50
- jb ls50buf
- mov bx,offset AB50
- call flmas
- jmp end_ls50buf
- ls50buf:
- mov bx,offset LS50
- call flmas
- end_ls50buf:
- ;print BUF
- mov al,dl
- push cx
- call printmas
- pop cx
- ;find MIN and MAX
- cmp si,1
- je pas
- mov al,[bx-1]
- cmp dl,al
- jbe min
- jae max
- pas:
- mov bx,offset MAXIM
- mov [bx],dl
- mov bx,offset MINIM
- mov [bx],dl
- jmp end_min
- max:
- mov bx,offset MAXIM
- mov [bx],dl
- jmp end_min
- min:
- mov bx,offset MINIM
- mov [bx],dl
- end_min:
- inc si
- loop lp
- mov ah,02h
- mov dl,10
- int 21h
- mov dx,offset PRMIN
- mov ah,09h
- int 21h
- mov bx,offset MINIM
- call printmaxmin
- mov ah,02h
- mov dl,10
- int 21h
- mov dx,offset PRMAX
- mov ah,09h
- int 21h
- mov bx,offset MAXIM
- call printmaxmin
- mov ah,2h
- mov dl,10
- int 21h
- mov dx,offset PRAB
- mov ah,9h
- int 21h
- mov bx,offset AB50
- mov cl,[bx+29]
- mov si,1
- lp1:
- xor ax,ax
- push cx
- mov al,[bx]
- call printmas
- pop cx
- inc si
- inc bx
- loop lp1
- mov ah,2h
- mov dl,10
- int 21h
- mov dx,offset PRLS
- mov ah,9h
- int 21h
- mov bx,offset LS50
- mov cl,[bx+29]
- mov si,1
- lp2:
- xor ax,ax
- push cx
- mov al,[bx]
- call printmas
- pop cx
- inc si
- inc bx
- loop lp2
- mov ah,4ch
- int 21h
- CODE ENDS
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement