I have a dword array of 15 random integers that is stored in esi. I have a bubble sort algorithm below which is supposed to arrange the values from lowest to highest. However when my program runs through this algorithm it doe not seem to touch any of the values and when I print the array it is exactly as it was before. Thoughts?
BubbleSort PROC USES eax ebx ecx edx esi
mov ecx, 0
mov ecx, 15
OUTER_LOOP:
push ecx
mov ecx,0
mov ecx,14
mov esi, OFFSET arr
COMPARE:
mov ebx,0
mov edx,0
mov bl, [esi]
mov dl, [esi+1]
cmp bl,dl
jg SWAP
CONTINUE:
add esi,4
loop COMPARE
mov esi, OFFSET arr
pop ecx
loop OUTER_LOOP
jmp FINISHED
SWAP:
mov bl, [esi]
mov dl, [esi+1]
xchg bl,dl
mov [esi],dl
mov [esi+1],bl
jmp CONTINUE
FINISHED:
ret
BubbleSort ENDP
Thanks for your help in advance.