[Coco] Let's figure out the best method to compile sprites for the CoCo - Please add your input

William Astle lost at l-w.ca
Sat May 13 00:37:52 EDT 2017


On 2017-05-12 10:23 PM, Darren A wrote:
> On Fri, May 12, 2017 at 9:51 PM, William Astle wrote:
>
>> Actually, if you're referring to replacing a LDA or LDB with INCA/DECA or
>> INCB/DECB, you do save a byte but you don't save a cycle. The 8 bit
>> immediate load instructions are 2 cycles, the same as accumulator INC/DEC.
>> It does save a byte, though, and that can be worth it.
>>
>> It will always be faster to do a 16 bit immediate load compared to a pair
>> of INC/DEC instructions. (16 bit immediate load of D is 3 cycles. Two
>> INC/DEC instructions in a row is 4 cycles.)
>>
>>
>
> Unless you happen to be targeting 6309 native mode where the A and B
> Inherent mode instructions take only 1 cycle.
>

A fair point. There's no negative to using INC/DEC (or 
COM/NEG/LSR/ASR/LSL if they work) in the 8 bit case on the 6809 and 
you'll save a byte so you might as well do it.

The 16 bit case matters whether you're targetting 6309 native mode. Two 
inherent mode (INC/DEC/etc) instructions on A/B will be both a byte 
smaller and a cycle faster than LDD in 6309 native mode. However, the 
pair will be a cycle slower than LDD on the 6809.

If you have to pick one for a project intended for general distribution, 
you'd want to use the 6809 optimization since you know every Coco is 
going to have something that will behave like a 6809.


More information about the Coco mailing list