dimanche 1 mars 2015

MASM Ascending sort to Descending Sort


Vote count:

0




So I have a sorted list that sorts in ascending order, I need it to descend.


Here is the code:



sortedList PROC

push ebp
mov ebp,esp
mov esi, [ebp + 12]
mov ecx, [ebp + 8]
dec ecx

loop1:
push ecx
mov esi, [ebp + 12]

exchange1:
mov eax, [esi]
cmp [esi + 4], eax
ja exchange2
xchg eax, [esi + 4]
mov [esi], eax

exchange2:
add esi, 4
loop exchange1
pop ecx
loop loop1
pop ebp
ret 8

sortedList ENDP


I already tried the method attempted the remedy in masm bubble sort in descending order but it did not work.



asked 1 min ago







MASM Ascending sort to Descending Sort

Aucun commentaire:

Enregistrer un commentaire