[stella] some more optimization tips

Subject: [stella] some more optimization tips
From: "Andrew Davie" <adavie@xxxxxxxxxxxxxxxxx>
Date: Sat, 9 May 1998 09:37:27 +1000
Delay loops seem fairly common in the kernal - or at least timed out
sections of code.  The optimisation need here is in code size, not speed!

For 2 cycle delays, costing 1 byte.. use a NOP
For 3 cycle delays, costing 2 bytes, use LDA $80 or similar
Rather than strings of NOPs, you can use the following...

    pha
    pla

Pairs of pha/pla cost only two bytes, yet use up 7 cycles each pair.
For longer delays.  put a label on one of your RTS instructions

return   RTS

now, whenever you want a 12 cycle delay you can go...

        JSR return

that will only cost you 3 bytes.

Using combinations of the above lets you maximise cycle time, and minimise
byte usage.

Enjoy!
A



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

Current Thread