I have been working on sort algorithms in assembler for a while and with a lot of help from members of the PowerBASIC forum, I have the first useful one ported to MASM. A CombSort is an algorithm designed by 2 guys from BYTE magazine in 1991 and it is a hybrid BUBBLE sort that uses a reducing GAP between elements that are sorted. While a bubble sort is very slow by itself depending on the data, this hybrid approach improved its speed by a considerable amount. I was lucky to have 3 versions of it to work from, one in basic, another in C and one in fortran.

I have a number of high level sort algorithms written in basic, C and pascal that seem to work OK. The fastest I have seen so far is a non-recursive Quick Sort written in an old dialect of basic that I ported to PowerBASIC. The original author is Ethan Winer who was a very experienced assembler programmer back in the days of Quick Basic.

If I can get this one working OK I will post it as well.


Posted on 2001-09-16 19:59:38 by hutch--
How does it compare with my QuickSort? :grin:
It's wrote to be very general - easily changed for sorting of more complex objects. It should be very readable - I just used macros to rename the registers = my lazy form of documentation. :)

Sorry, but if you downloaded the last file it doesn't work. :( Too many bad versions here in too many different assembler languages. :) Just download the one below and your all set.
Posted on 2001-09-16 22:45:58 by bitRAKE

For mere mortals who read mnemonics better than macros, do you have the PRE macro version so I can have a look at it. From what I could tell with the macro version you have, it looks like a recursive quick sort but converting it to mnemonics and benchmarking it as is looks a hell of a task.


Posted on 2001-09-17 05:20:12 by hutch--
...maybe this one works?

Use it like...
INCLUDE qsort.asm

TheArray dd 6,324,7,73,3,424,678,894,12,53,65,7356
invoke QuickSort,ADDR TheArray,0,(SIZEOF TheArray)/4 - 1
It's nothing fancy Hutch--, but I will convert it to non-macro version when I get home later today. They are all registers: for example '?ARRAY' is always esi. I don't have a pre-macro version -- I designed it that way. :) Do you have a problem assembling it?

I won't post this again 'til I have a benchmark. :tongue:
Posted on 2001-09-17 09:13:45 by bitRAKE