[Coco] Let's figure out the best method to compile sprites for the CoCo - Please add your input
Glen Hewlett
glen.hewlett at sympatico.ca
Fri May 12 14:48:47 EDT 2017
Great idea Curtis!
That’s definitely something else to add to the collection of ideas on how to create the smallest and fastest compiled sprites.
Thanks for the input,
Glen
> On May 12, 2017, at 10:56 AM, L. Curtis Boyle <curtisboyle at sasktel.net> wrote:
>
> Since PSHing goes backwards in RAM, it might be more efficient to draw your sprite from bottom to top (better chance that your LEAU’s will be smaller), depending on the graphics mode you are using, and the width of the sprite.
>
> L. Curtis Boyle
> curtisboyle at sasktel.net
>
>
>
>> On May 11, 2017, at 5:41 PM, Glen Hewlett <glen.hewlett at sympatico.ca> wrote:
>>
>> Hi Mark,
>>
>> Your comment about stack blasting made me think, why not combine both compiled sprites using LDD and STD etc. with PULU D,X instructions and use U as a pointer instead of X. That might work especially well for sprites that have repeating patterns or are all one colour like Pacman.
>>
>> I’m just thinking off the top of my head here and the order of the bytes might be off, but I could do something like this (using my Pacman sprite data from the previous post):
>> Setup U with the location in Video RAM where the sprite will be
>> LEAS 8,S [2] [5]
>> LDD #$4444 [3] [3]
>> LDX #$4444 [3] [3]
>> PSHU D,X [2] [9]
>> PSHU D,X [2] [9]
>> LEAU 136,U [4] [8]
>> LDD #$9944 [3] [3]
>> PSHU D,X [2] [9]
>> LDD #$4999 [3] [3]
>> STD -2,U [2] [6]
>> STD -4,U [2] [6]
>> LEAU 124,U [4] [8]
>>
>> This new method uses 32 bytes and 72 CPU cycles. Where my previous version for the first two rows of the pacman sprite used 37 bytes and took 73 CPU cycles. This is 5 bytes smaller and is 1.3% faster You can also use the Y register for the stack blasting to get even more value out of each PULU instruction.
>>
>> The down side of this is that you will also probably need to PSHS the U register before drawing the sprite and PULS U after unless you don’t need the U for your code.
>>
>> I’ll have to do more testing with this technique to see if other sprites will benefit from it, but it looks promising especially for sprites that have a lot of repeating data.
>>
>>
>> As for Pacman
>>
>> I’ve done lots of testing with ways for doing the sprites for Pacman and it’s fastest to leave the black as black and not transparent for Pacman since everything pacman runs over gets erased anyways. As for the mouth opening you can’t really notice it’s not going in it’s mouth because it goes so fast. I might tweak it a little more so that the pills go in the mouth a little, we’ll see.
>>
>> Yes I have worked out the order of the sprite drawing in normal chase mode vs. when a power pill is eaten. Thanks for letting me know though. :)
>>
>> Cheers,
>> Glen
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> https://pairlist5.pair.net/mailman/listinfo/coco
>>
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
More information about the Coco
mailing list