Advertisement
Guest User

Untitled

a guest
Nov 25th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DATA SEGMENT
  2. BUF DB 29 dup (?)
  3. MINIM DB 0
  4. MAXIM DB 0
  5. LS50 DB 30 dup (0)
  6. AB50 DB 30 dup (0)
  7. PRBUF DB 'BUF: $'
  8. PRMIN DB 'MIN: $'
  9. PRMAX DB 'MAX: $'
  10. PRAB DB 'AB50: $'
  11. PRLS DB 'LS50: $'
  12. DATA ENDS
  13. CODE SEGMENT
  14. ASSUME CS:CODE,DS:DATA
  15. flmas proc              
  16.     mov al,[bx+29]      
  17.     inc ax
  18.     mov [bx+29],al
  19.     dec ax
  20.     add bx,ax
  21.     mov [bx],dl          
  22.     ret
  23. flmas endp
  24.  
  25. printmas proc
  26.     push bx
  27.     push dx
  28.     xor cx,cx
  29.     mov bx,10
  30. oi2:
  31.     xor dx,dx
  32.     div bx
  33.     push dx
  34.     inc cx
  35.     cmp ax,0
  36.     jne oi2
  37.     mov ah,02h
  38. lip:
  39.     pop dx
  40.     add dx,30h        
  41.     int 21h            
  42.     loop lip
  43.     mov dx,20h        
  44.     int 21h
  45.     pop dx
  46.     pop bx
  47.     ret
  48. printmas endp
  49.  
  50. printmaxmin proc
  51. xor ax,ax
  52. mov al,[bx]
  53. call printmas
  54. ret
  55. printmaxmin endp
  56.  
  57. start:
  58. mov ax,data
  59. mov ds,ax
  60. mov dx,offset PRBUF
  61. mov ah,9h
  62. int 21h
  63. mov si,1
  64. mov cx,29
  65. lp:
  66.      mov ax,si      
  67.      mov dl,5
  68.      mul dl        
  69.      push ax
  70.      mov ax,si      
  71.      mov dl,3
  72.      div dl        
  73.      pop dx        
  74.      add dl,al      
  75.      cmp dx,50
  76.      jl ls          
  77.      mov ax,50
  78.      jmp endls
  79.      ls:
  80.           mov ax,dx
  81.           mov dx,50
  82.      endls:
  83.      mov bx,offset BUF
  84.      add bx,si
  85.      dec bx
  86.      sub dx,ax      
  87.      mov [bx],dl
  88.  
  89.      ;fill new massive
  90.      cmp dl,50
  91.      jb ls50buf    
  92.      mov bx,offset AB50
  93.      call flmas
  94.      jmp end_ls50buf
  95.  
  96.      ls50buf:
  97.      mov bx,offset LS50
  98.      call flmas
  99.      end_ls50buf:
  100.  
  101.      ;print BUF
  102.      mov al,dl
  103.      push cx
  104.      call printmas
  105.      pop cx
  106.  
  107.      ;find MIN and MAX
  108.      cmp si,1
  109.      je pas                  
  110.      mov al,[bx-1]
  111.      cmp dl,al
  112.      jbe min
  113.      jae max
  114.      pas:
  115.      mov bx,offset MAXIM
  116.      mov [bx],dl
  117.      mov bx,offset MINIM
  118.      mov [bx],dl
  119.      jmp end_min
  120.      max:
  121.      mov bx,offset MAXIM
  122.      mov [bx],dl
  123.      jmp end_min
  124.      min:
  125.      mov bx,offset MINIM
  126.      mov [bx],dl
  127.      end_min:
  128.      inc si        
  129. loop lp
  130.  
  131. mov ah,02h
  132. mov dl,10                
  133. int 21h
  134. mov dx,offset PRMIN
  135. mov ah,09h
  136. int 21h
  137. mov bx,offset MINIM
  138. call printmaxmin
  139.  
  140. mov ah,02h
  141. mov dl,10
  142. int 21h
  143. mov dx,offset PRMAX
  144. mov ah,09h
  145. int 21h
  146. mov bx,offset MAXIM
  147. call printmaxmin
  148.  
  149. mov ah,2h
  150. mov dl,10
  151. int 21h
  152. mov dx,offset PRAB
  153. mov ah,9h
  154. int 21h
  155. mov bx,offset AB50
  156. mov cl,[bx+29]
  157. mov si,1
  158. lp1:
  159.     xor ax,ax
  160.     push cx
  161.     mov al,[bx]
  162.     call printmas
  163.     pop cx
  164.     inc si
  165.     inc bx
  166. loop lp1
  167.  
  168. mov ah,2h
  169. mov dl,10
  170. int 21h
  171. mov dx,offset PRLS
  172. mov ah,9h
  173. int 21h
  174. mov bx,offset LS50
  175. mov cl,[bx+29]
  176. mov si,1
  177. lp2:
  178.     xor ax,ax
  179.     push cx
  180.     mov al,[bx]
  181.     call printmas
  182.     pop cx
  183.     inc si
  184.     inc bx
  185. loop lp2
  186.  
  187. mov ah,4ch
  188. int 21h            
  189. CODE ENDS
  190. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement