drew99 0 Newbie Poster

I've made ​​some changes to the algorithm BubbleSort, dividing the array to be ordered in n array consisting of 10 elements. The code should order the first n array and then all the main array and display the content, but I do not get any results. Any advices?

.data
array SDWORD 10 DUP(10009h, 10002h, 10003h, 10004h, 10001h, 10006h, 10007h, 10008h, 10005h, 10010h)
len DWORD lengthof array

.code
MAIN PROC
INVOKE BBSORT, ADDR array, len
mov esi, offset array
call Funzione che visualizza parte della memoria
MAIN ENDP

BBSORT PROC USES eax ecx esi, aarr: PTR SDWORD, larr: DWORD
LOCAL part: DWORD, cloop: BYTE
mov edx, 0
mov eax, larr
mov ebx, 10
div ebx
mov ecx, 2
push edx
mov part, 0
mov cloop, 0
lp:
push ecx
mov eax, 0
cmp part, 0
je ls  
mov edx, 0
mov eax, part
mul ebx
shl eax, 2
mov edx, eax
ls:
dec ecx
cmp ecx, 0
je lr
l1:
push ecx
mov ecx, ebx
dec ecx
mov esi, aarr
add esi, edx
l2:
call DumpRegs
mov eax, [esi]
cmp [esi + 4], eax
jg l3
xchg eax, [esi + 4]
mov [esi], eax
l3:
add esi, 4
loop l2
pop ecx
loop l1
mov esi, aarr
add esi, edx
inc part
pop ecx
loop lp
jmp lr
cmp cloop, 2
je lr
cmp cloop, 1
je la
pop edx
mov ecx, edx
mov part, 0
mov cloop, 1
jmp lp
la:
mov ecx, 100
mov part, 0
mov cloop, 2
jmp lp
lr:
ret
BBSORT ENDP
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.