Re: [stella] brother can you spare a kernal?

Subject: Re: [stella] brother can you spare a kernal?
From: Thomas Jentzsch <tjentzsch@xxxxxx>
Date: Wed, 10 Sep 2003 11:59:23 +0200
KirkIsrael@xxxxxxxxxxxxx wrote:
>Would anyone like to collaborate with me on this?
>I'm kind of stuck :-/ 

I am doing something similar in Jammed. The kernel is quite 
simple, but I'll try to explain anyway:

Instead of counting scanlines for each PF-block I am simply 
counting down the total scanlines and compare those with values 
from a precalculated table.

Your outcommented code uses up to 34 cycles. 

And then you *always* need 5 cycles for doing this:
  dex				          ; 2
  bne MainGameLoop		    ; 2³

That makes 39 cycles.

Here is my 1st version:
  txa				          ; 2
  ldy counterPFBlock		    ; 3
  cmp BlockTable,y		    ; 4   no cpx abs,y, too bad! :-(
  bne DoneChangingPlayfieldBrick  ; 2³
  inc counterPFBlock		    ; 5
  lda playfieldMatrixLeft+1,y	    ; 4
  sta bufferPFLeft		    ; 3
  lda playfieldMatrixRight+1,y    ; 4
  sta bufferPFRight		    ; 3
DoneChangingPlayfieldBrick	    ; 
  dex				          ; 2
  bne MainGameLoop		    ; 2³= 18/35

Four cycles saved. :-)


Now let's reduce that loop overhead too:

MainGameChangeLoop                ;   = 12
  dex					    ; 2	
  inc counterPFBlock		    ; 5
  lda playfieldMatrixLeft+1,y	    ; 4
  sta bufferPFLeft		    ; 3
  lda playfieldMatrixRight+1,y    ; 4
  sta bufferPFRight		    ; 3 = 33
MainGameLoop
  ...

  txa				          ; 2
  ldy counterPFBlock		    ; 3
  cmp BlockTable,y		    ; 4	
  beq MainGameChangeLoop    	    ; 2³
  dex				          ; 2
  bne MainGameLoop		    ; 2³= 18

Two more cycles saved. 

There are more options, e.g. removing WSYNC or using the X and Y 
differently, but maybe the additonal 6 cycles are doing the job 
for you now.

Have fun!	
Thomas


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


Current Thread