data segment
 buf dw 3,4,8,1,6,5,7,2,0,9
 N=($-buf)/2
data ends
code segment
 assume cs:code,ds:data
start:
 mov ax,data
 mov ds,ax
 mov bx,0
 mov dx,0
 mov cx,N
L1:
 push cx
 push bx
 mov si,bx 
L2: 
 mov ax,buf[si]
 cmp ax,buf[bx+2]
 jge NEXT
 xchg ax,buf[bx+2]
 mov buf[si],ax
NEXT:
 add bx,2
 loop L2
 pop bx
 pop cx
 add bx,2
 loop L1
 
 mov ax,4c00h
 int 21h
code ends
 end start