Re: [stella] single digit scoring...

Subject: Re: [stella] single digit scoring...
From: Christopher Tumber <christophertumber@xxxxxxxxxx>
Date: Sun, 24 Aug 2003 20:39:46 -0400
Erik wrote:

>	LDY #5
>Loop
>	STA WSYNC
>	LDA (TempPointer), Y
>	STA GRP0
>	DEY
>	BNE Loop

I wrote:

>	LDA p0score ;accumulator = score
>	ROL ;accumulator = score * 2
>	ROL ;accumulator = score * 4
>	ADC p0score  ;accumulator = (score * 4) + score = score * 5
>       TAY
>	LDA Score0Graphic,y
>	STA GRP0

Either of these is a perfectly valid way to go, it all really depends upon your allocation of resources.

Erik's method is good if you're using Y as a general scanline counter anyway and you can spare the two bytes RAM to make TempPointer. My version saves you the RAM, but doesn't share the Y register well. Erik's is also going to be quicker in the Kernal, but overall a little slower given the extra overhead pre-calculating TempPointer. This is probably getting ahead of things, but these are the kind of decisions you eventually have to make once you start running out of RAM/registers/cycles....


And an in between method might be:

Setup Everything during Vertical Blank/Overscan:

     LDA p0score ;accumulator = score
     ROL ;accumulator = score * 2
     ROL ;accumulator = score * 4
     ADC p0score  ;accumulator = (score * 4) + score = score * 5
     STA TempOffsetValue

In the Kernal:

       LDX #5
Loop
       STA WSYNC
       LDY TempOffsetValue
       LDA Score0Graphic,y
       STA GRP0
       DEX
       BNE Loop

- Fastest in the Kernal and only uses 1 byte RAM but uses up both X and Y registers....

Chris...

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


Current Thread