[stella] An Efficient Waste Of Time

Subject: [stella] An Efficient Waste Of Time
From: Christopher Tumber <christophertumber@xxxxxxxxxx>
Date: Thu, 17 Oct 2002 17:01:34 -0400
One thing I've found... annoying if wasting a bunch of ROM space doing noting. That is, burning cycles for timing purposes but at the cost of ROM space. Ideal solution would be various flavour NOPs, all using 1 byte but consuming 2-a bunch of cycles. Unfortunately that's just not the case.

So these are the instructions and instruction combinations that I've been using to waste cycles. Anybody have any better ones?




--------------------------------------------------------------------------

1 Cycle (0 or 1 byte)
.w (Make a zero page instruction an absolute instruction)
      or
,x (Make a zero page or absolute instruction an indexed instruction)

Notes: .w adds a byte of code.
       ,x needs x=0 (can also use y register)

--------------------------------------------------------------------------

2 Cycles (1 byte)
NOP

--------------------------------------------------------------------------

3 Cycles (2 bytes)
STA $ZeroPage
     or
LDA $ZeroPage
     or
DOP $ZeroPage

Notes: STA/LDA Destroys register or RAM location (use scratch variable)

--------------------------------------------------------------------------

4 Cycles (2 bytes)
NOP
NOP

--------------------------------------------------------------------------

5 Cycles (2 bytes)
dec $ZeroPage

Notes: Destroys RAM location (use scratch variable)

--------------------------------------------------------------------------

6 Cycles (3 bytes)
NOP
NOP
NOP

--------------------------------------------------------------------------

7 Cycles (2 bytes)
PHA
PLA

Notes: Don't overflow stack

--------------------------------------------------------------------------
8 Cycles and more - combinations of the above, or loop.


[You can use PHA/PHP (1 byte 3 cycles) or PLA/PLP (1 byte 4 cycles) alone but you have to be carefull not to mess up your stack (PLP/PHA would be usefull if you have no stack!)]



Chris...

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


Current Thread