Re: [stella] DD Dead end?

Subject: Re: [stella] DD Dead end?
From: Thomas Jentzsch <tjentzsch@xxxxxx>
Date: Thu, 8 Nov 2001 22:42:27 +0100
Glenn Saunders wrote:
> What's killing me is the playfield stuff.  If I didn't have a dynamic
> playfield I'd probably have enough time.  The playfield overhead involves 
> not only the load/stores but the looping logic to index through all the 
> tombstone graphics.

I don't know your actual code, but there were still a lot of possible
optimizations in the version 10 kernel:

The playfield overhead can be reduced by removing
CurrentTombstoneSubRow. This is possible, if you use a ROM table where
the Y values for each end of a playfield block are stored. Here is a
little piece of code, that demonstrates what I mean:

    CLC                    ;+2
    NOP                    ;+2
.nextBlock:                ;        carry is always clear here
    DEY                    ;+2
    TYA                    ;+2      there is no CPY abs,X opcode :(
    CMP   BlockLine,X      ;+4
    BCS   .contBlock       ;+2/3
    DEX                    ;+2
    BNE   .nextBlock       ;+2/3

    .BYTE 160,152,144,136...    ; just an example

This code always takes 15 cycles, which is two cycles less than your

Two more cycles can be saved by using TXS, TSX instead of Temp again.
In the code I know, you could completely avoid storing/restoring X, but
I guess, you will need X for the missile code too.

Another very good option is, to avoid WSYNC at all. "Just" make all your
code constant timed, like I did in my example above. That way you get up
to 10 extra cycles (some of them may be eaten up by extra cycles needed
to make the cycle count constant).

By trying to make the carry-state constant (see example above) some more
cycles may be saved. At the moment there are two SECs in the kernel,
avoiding them could save you up to 4 cycles.

As you can see, there are still a lot of chances to save cycles. Maybe
you should mail your best code, even if it doesn't fit into the 2*76
cycles or meets all restrictions and we can help you optimizing it.

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

Archives (includes files) at
Unsub & more at

Current Thread