vdub_bobby #1 Posted July 7, 2005 Here's my situation: I am writing a (2600) kernel that uses Y to count scanlines but also uses X to count down as well. 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? Quote Share this post Link to post Share on other sites
cd-w #2 Posted July 7, 2005 Here's my situation: I am writing a (2600) kernel that uses Y to count scanlines but also uses X to count down as well. 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? 887790[/snapback] I'm not sure exactly how BlockChange works, but if you could extend it to have a separate entry for every scanline then you could combine X & Y as follows to save 3 cycles: dey +2 bmi EndKernel +2 lda BlockChange,Y +4 bne KernelLoopa +2 beq KernelLoopb +2 EndKernel Chris Quote Share this post Link to post Share on other sites
Robert M #3 Posted July 8, 2005 Hello, Without understanding the relationship of the loopa and loopb labels to the flow of the kernel code its hard to recommend an optimization. Can you post the complete loop? Also is the BlockChange table stored in RAM or ROM? Cheers! Quote Share this post Link to post Share on other sites
cd-w #4 Posted July 11, 2005 This discussion moved to the Stella mailing list: http://www.biglist.com/lists/stella/archiv...7/msg00031.html It looks like this is part of the PoP kernel, so I am hoping to see some more developments there soon! Chris Quote Share this post Link to post Share on other sites
vdub_bobby #5 Posted July 12, 2005 Hello, Without understanding the relationship of the loopa and loopb labels to the flow of the kernel code its hard to recommend an optimization. Can you post the complete loop? Also is the BlockChange table stored in RAM or ROM? Cheers! 888337[/snapback] I don't really want to post the complete loop at this time, but the BlockChange table is stored in ROM. I have come to a solution, though; thanks to everyone here (and on [stella] who helped). Sorry, though - it isn't for a 2600 Prince of Persia. It is for something else... Quote Share this post Link to post Share on other sites