Advertisement
Guest User

Untitled

a guest
Apr 6th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .model small
  2. .stack 100h
  3. equ db num 10
  4. .data
  5. Old db 3, 10, 15,5 ,7 ,18, 9 , 20 ,5 ,1
  6. New db num dup 0
  7. .code
  8. begin:
  9.     move ax, @data
  10.     move ds, ax
  11.     lea bx, Old
  12.     lea di, New
  13.  
  14.     mov ax, 0
  15. L1:
  16.     mov cx, 0
  17.     cmp al, num
  18.     ja sof
  19.     mov ah, al
  20.     inc ah
  21.     push bx
  22.     mov dl, [bx]
  23.     add bx, ah
  24.    
  25. L2:
  26.     cmp ah, num
  27.     jg sofL2
  28.  
  29.     mov dh, [bx]
  30.  
  31.     cmp dh, dl
  32.     jl dont_count  
  33.     inc cx
  34. dont_count:
  35.     inc bx
  36.     inc ah
  37.     jmp L2
  38. sofL2:
  39.     pop bx
  40.     mov [di], cl
  41.     inc di
  42.     jmp L1
  43. sof:
  44.     mov ah, 4ch
  45.     int 21h
  46. end begin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement