[Coco] Optimizing 6809 Assembly Code: Part 2 – Speedup Storing Data – Unrolling Loops

Glen Hewlett glen.hewlett at sympatico.ca
Sat Sep 16 10:43:45 EDT 2017


Thanks Darren,

Simon Jonassen commented the same thing on Facebook.  I updated Part 2 of the series to include this method, I think pointing out the use of negative numbers for the indexing is also a valuable tip.  I’ll add that info too and update Part 2 again.  :)

Please keep the ideas flowing…. This is great stuff!

Cheers,
Glen

> On Sep 16, 2017, at 1:17 AM, Darren A <mechacoco at gmail.com> wrote:
> 
> On Fri, Sep 15, 2017 at 8:44 PM, Glen Hewlett wrote:
> 
>> Hi Again,
>> 
>> I just posted Part 2 of my series of blogs about optimizing 6809 assembly
>> language programs.
>> 
>> https://nowhereman999.wordpress.com/2017/09/15/
>> optimizing-6809-assembly-code-part-2-speedup-storing-data-unrolling-loops/
>> <https://nowhereman999.wordpress.com/2017/09/15/
>> optimizing-6809-assembly-code-part-2-speedup-storing-data-unrolling-loops/
>>> 
>> 
>> 
> 
> In your first unrolled loop example, you could have saved a fair amount of
> time by not using the auto-increment index mode.  You only need to
> increment X once per loop using ABX.  The ,X++ adds 3 cycles to the base
> count.  Using 5-bit displacements (-16 to +14) keeps the code size small
> and only adds 1 cycle to the base count. You will also have one occurrence
> of ,X which adds nothing.
> 
>    LDX    #$4000+16
>    LDU    #$0000
>    LDD    #$0020
> 
> !   STU    -16,X
>    STU    -14,X
>    STU    -12,X
>    STU    -10,X
>    STU    -8,X
>    STU    -6,X
>    STU    -4,X
>    STU    -2,X
>    STU    ,X
>    STU    2,X
>    STU    4,X
>    STU    6,X
>    STU    8,X
>    STU    10,X
>    STU    12,X
>    STU    14,X
>    ABX
>    DECA
>    BNE    <
> 
> 
> - Darren
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco



More information about the Coco mailing list