Monday, 14 August 2017

Sort element of array in ascending order Assembly Language Program using tasm (MP)

data segment
arr dw 5434h,6727h,4345h,1234h,3333h
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov ch,04h
back:
lea si,arr
mov cl,04h
up:
mov ax,[si]
cmp ax,[si+2]
jc down
mov bx,[si+2]
mov [si+2],ax
mov [si],bx
down:
inc si
inc si
dec cl
jnz up
dec ch
jnz back
int 03h
code ends
end start

No comments:

Post a Comment