thanks for your reply this program you saw it print out one digit Ok ,but I want to print out two digits the assembler I'm using is NASM and my processor is 32 bit.
So this code you saw for one digit .Is there a way print out to digits if we change the data to 60,80,50. who can I print out them ?Do I need a stack or what??

Code:
org 0x0100
;mov [swap],0
mov cx,1
jmp start


data: dw  6,8,0,5,7,9,2,3,1,4

swap: db 0



start:  mov bx,0
mov byte [swap],0

loopl: mov ax, [data+bx]
cmp ax,  [data+bx+2]
jbe noswap



mov dx,[data+bx+2]
mov  [data+bx+2],ax
mov [data+bx],dx
mov byte[swap],1



noswap:  add bx,2
cmp bx,18
jne loopl

;xopr [swap],[swap]

add  cx,1
cmp cx,10
jbe start


mov cx,10
mov bx,data

printsorted:


mov  al, [bx]
add bx,2
or al, 30h
mov ah,0eh
int 10h
sub cx,1
jnz  printsorted

mov ax,0x4c00
int 0x21

Last edited by shabbir; 10May2010 at 20:43.. Reason: Code Block