Assembly Language Forum

Ask Question   UnAnswered
Home » Forum » Assembly Language       RSS Feeds

Sort an array (Bubble sort)

  Asked By: Art    Date: Nov 02    Category: Assembly Language    Views: 5459

Develop an 8086 assembly program that performs sorting of a unsigned integer 10
elements array using bubble-sort algorithm. The array is stored in memory.

Please help



1 Answer Found

Answer #1    Answered By: Sergey Kamenev     Answered On: Nov 12

;Bubble sort of dword array
; Parameters:
; ESI - array address
; ECX - array length (number of elements)
dec ecx
cmp ecx,0
jl .mEx

push esi
push ecx
mov bl,0
mov eax,[esi]
cmp eax,[esi+4]
jle .mSkipR
mov edx,[esi+4]
mov [esi],edx
mov [esi+4],eax
mov bl,1
add esi,4
loop .mOne
pop ecx
pop esi

cmp bl,0
je .mEx
jmp .mMain


Didn't find what you were looking for? Find more on Sort an array (Bubble sort) Or get search suggestion and latest updates.