well, its the usuall alogirhm, not much to optimize
this is is for 16bit asm coders .
u can sort an array by giving the function what do to:
arr_sort(Size,$addr_of_mat,signed/unsigned items,direction up/down)

mabye someone will use it..probably now, but the more source code, the more we learn :)
Posted on 2003-07-01 03:59:52 by wizzra
argh ,
here it is :)
Posted on 2003-07-01 04:03:01 by wizzra
Maybe this code would interest you, though it is of 32bit.
; bubble sort

; input:
; edi = pointer to array
; ecx = number of indexes
; output:
; edi = pointer to sorted array
; destroys:
; eax, edx
; eflags

lea ebx,[edi+ecx*4]
mov eax,[edi]
sub ebx,4
cmp eax,[ebx]
jle notyet
xchg eax,[ebx]
cmp ebx,edi
jnz cmploop
loop outerloop


; 16 byte bubblesort by Joergen Ibsen / Jibz <jibz@hotmail.com>
; enter: edi -> array
; ecx = #elements
; exit: edi -> array
; ecx = 0
; modify: ecx
pushad ; save edi and ecx
mov esi, edi
cmp eax, [esi] ; do we need to swap?
jge order_ok
xchg eax, [esi] ; if so, this is first step
stosd ; second step, or just write back eax
loop innerloop
popad ; pop edi and ecx
loop outerloop ; ecx is used for both loops
Posted on 2003-07-01 04:05:21 by roticv
lol, i always forget to upl the good file

hi rotiv,
yeha Bouble sort is very quickly done, the reason why i didn't used 32bit is cuz tommorow i have an asm test which is 16bit only, and i am doing some fast algos tohelp me during test :)
thnx for your post, i can reVise it to 16 though :)
Posted on 2003-07-01 04:10:15 by wizzra