caplan8293
Programmer
Hi, I need the code for a sort in assembly language. I am not concerned with speed so
bubble sort is fine. I have an array of 10 8-bit numbers that need sorting and I am trying to convert my C++ code of bubble sort to assembly language but am failing
miserably... Can anyone help me out? I found this code on the net for 32-bit
numbers for a bubble sort but can't convert it to an 8-bit version... Thanks a lot!
caplan8293
;bubble sort for 32-bit
; by Andrew Howe
outerloop: lea ebx,[edi+ecx*4]
mov eax,[edi]
cmploop: sub ebx,4
cmp eax,[ebx]
jle notyet
xchg eax,[ebx]
notyet: cmp ebx,edi
jnz cmploop
stosd
loop outerloop
bubble sort is fine. I have an array of 10 8-bit numbers that need sorting and I am trying to convert my C++ code of bubble sort to assembly language but am failing
miserably... Can anyone help me out? I found this code on the net for 32-bit
numbers for a bubble sort but can't convert it to an 8-bit version... Thanks a lot!
caplan8293
;bubble sort for 32-bit
; by Andrew Howe
outerloop: lea ebx,[edi+ecx*4]
mov eax,[edi]
cmploop: sub ebx,4
cmp eax,[ebx]
jle notyet
xchg eax,[ebx]
notyet: cmp ebx,edi
jnz cmploop
stosd
loop outerloop