RE: [stella] Loops with two counters

Subject: RE: [stella] Loops with two counters
From: "Bob Montgomery" <BobM@xxxxxxxxxxx>
Date: Thu, 7 Jul 2005 15:54:06 -0400
Hi,

here's a bigger snippet:

Kernel1Loopa
   SLEEP 4            ;+4   63
Kernel1Loopb
   ;---display a bunch of stuff for 61 cycles

  dey                 ;+2   50

  tya                 ;+2   52
  cmp BlockChange,X   ;+4   56
  bne Kernel1Loopa    ;+2   58
  dex                 ;+2   60
  bpl Kernel1Loopb    ;+3   63

so there are 4 free cycles that can be used on the scanlines when X doesn't change.

-bob



-----Original Message-----
From: Manuel Rotschkar [mailto:cybergoth@xxxxxxxx]
Sent: Thursday, July 07, 2005 12:47 PM
To: stella@xxxxxxxxxxxxxxxxxx
Subject: Re: [stella] Loops with two counters


Hi Bob!

> So, the looping code looks something like this:
>
>   dey                 ;+2   50
>
>   tya                 ;+2   52
>   cmp BlockChange,X   ;+4   56
>   bne Kernel1Loopa    ;+2   58
>   dex                 ;+2   60
>   bpl Kernel1Loopb    ;+3   63
>
> That takes 15 cycles. Is there a faster way?  I really need a few more 
> cycles :)

Hard to tell from the snippet. If you'd swap x and y, you could do
cpx BlockChange,y
saving you the 2 cycles for the TYA...

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

Current Thread