Re: Aw: Re: [stella] Star Fire: Getting Closer: Perfect Sorting solution

Subject: Re: Aw: Re: [stella] Star Fire: Getting Closer: Perfect Sorting solution
From: Manuel Polik <cybergoth@xxxxxxxx>
Date: Thu, 28 Mar 2002 20:30:32 +0100
Hi Thomas!

>>Tada: ->Even though the routine was buggy, it 
>>        _improved_ the sorting!

>Nice idea. :-)

Thanks! :-)

>So you get 2*(8-1) = 14 compares/max. swaps vs. 8*(8-
1)/2 = 28 
>for a complete Bubble Sort and save ~50% cycles.

I already know how to still improve it!

-> I remove the outer loop completely!

So I can strobe just one sorting run with:
JSR ImproveSort

That way I can even freely shift sorting loads between 
VBLANK and the Overscan, just where it fits!


>>> Looks really good, but sometimes (mainly small) 
>>> disappear completely (e.g. the red fighter). Is that 
>>> intentional?
>>Hm... I've yet to analyse that. Do they only disappear 
>>when near the top or bottom?

>>Or do they disappear, when there's 3 or more 
>>objects in line?

>No, I couldn't find *any* pattern. I think this is 
probably a 
>side effect of the non-perfect sorting you are doing.

Ah, I analysed it now some more, and I think I found a 
pattern :-)

I'd say it occurs when two sprites just differ by one in 
their vertical starting position. Ok, I've already an 
idea where that comes from.

Actually the bug can't come from the imperfect sort:
Even if you don't push the fire button, the sorting is 
still improved and should be perfect after 4 frames. You 
can actually *see* the effect, when starting the BIN 
with the log enabled (or slowing Z26 down with MoSlo). 
Even though they don't move, one ship after another is 
then beaming into the scene :-)


Archives (includes files) at
Unsub & more at

Current Thread