Re: [stella] unrolling inner loop

Subject: Re: [stella] unrolling inner loop
From: "Thomas Jentzsch" <tjentzsch@xxxxxx>
Date: Fri, 9 Nov 2001 09:14:19 +0100
Glenn wrote:
> I attempted to unroll the inner tombstone loop...

Before you start unrolling, you should try to optimize the kernel to it's maximum first. Unrolling is allways the last thing I would do, because it extremly increases the chances of potential bugs as long as you are still work inside the kernel. And that makes optimizing even harder.

And I just noticed, that your tombstone-height is 8, which makes it possible to squeeze my last code a bit more. Now, you don't need the table, you just can use AND:

    NOP                    ;+2
    NOP                    ;+2
.nextBlock:                ;        carry is unchanged
    DEY                    ;+2
    TYA                    ;+2      
    AND   #7               ;+2
    BNE   .contBlock       ;+2/3
    DEX                    ;+2
    BNE   .nextBlock       ;+2/3

That saves another 2 cycles.

> ...and I'm probably doing 
> something wrong with the TXS/TSX because the first frame seems to display 
> okay and then the screen goes haywire.

> Please take a look at this source to see what's wrong.

You have to store the contents of the stackpointer at the begin of your subroutine and restore it before RTS.

Have fun!
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |

Geben Sie Ihren Lottotipp gerne auf den letzten Drücker ab?Beim WEB.DE
Lottoservice gibt's keine Warteschlangen.

Archives (includes files) at
Unsub & more at

Current Thread