Friday, 4 November 2011

check even or odd and sort both even and odd in assending order


mov bx,[3000h]
dec bx
l3:mov cx,bx
mov si,2000h
l1:mov al,[si]
inc si
cmp al,[si]
jb l2
xchg al,[si]
mov [si-1],al
l2:loop l1
dec bx
jnz l3
jmp l4
l4:mov cx,[3000h]
mov si.2000h
mov di,4000h
mov bx,02h
l5:mov ax,[si]
div bx
cmp dx,00h
jz l6
jmp l7
l6:mov ax,[si]
mov [di],ax
inc di
inc di
l7:inc si
inc si
loop l5
jmp l8
l8:mov cx,[3000h]
mov si.2000h
mov di,4500h
mov bx,02h
l9:mov ax,[si]
div bx
cmp dx,00h
jnz l10
jmp l11
l10:mov ax,[si]
mov [di],ax
inc di
inc di
l11:inc si
inc si
loop l8
hlt

No comments:

Post a Comment