Re: [stella] Bubble Sort

Subject: Re: [stella] Bubble Sort
From: "Tim Boescke" <t.boescke@xxxxxxxxxxxxx>
Date: Mon, 25 Mar 2002 21:42:58 -0500
> >(Sorry 
> >Thomas, I won't rely on any assumptions and *normally* 
> >theories. I don't know what I'm doing with that routine 
> >in the future, so it must do 100% always, no matter what 
> >input I feed it :-))
> 
> I understand.
> 
> 
> >So, is anybody here seeing a spot where to still speed-
> >up the algorithm? (Without illegal opcodes... :-))
> 
> Ok, the challenge is taken: :-)
> 
> "BubbleSort": (optimized code, non working!)

How about this ? Sometimes it is a good idea
to optimize the algorithm. Sorry, untested
and unfinished but you get the idea..


    [...]
outerloop:
    STX tempVar1
    LDY indextbl+1,x
    LDA ypos,y
innerloop:
    LDY indextbl,x
    CMP ypos,y
    BPL nochange
    LDA ypos,y
    STX tempVar2
nochange:   
    DEX
    BPL innerloop  
    
    ... swap entries at tempvar1+1 and tempvar2, 
    decrease tempvar1, loop...


----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread