[Coco] Optimizing 6809 Assembly Code: Part 2 – Speedup Storing Data – Unrolling Loops
Glen Hewlett
glen.hewlett at sympatico.ca
Fri Sep 15 23:13:23 EDT 2017
Thanks Dave,
This is a cool trick. I will definitely add it to my blog posts.
Cheers,
Glen
> On Sep 15, 2017, at 11:06 PM, Dave Philipsen <dave at davebiz.com> wrote:
>
> Here's a little trick you could add to your blog. I think I posted an example of this before. I don't know that it necessarily optimizes for speed but it saves space. When printing a string or any kind of calling a subroutine which requires a string, instead of pointing to the string and then calling the subroutine like this:
>
> ldx #strptr point to the string
> jsr prtstr print the string
> lda #?? continue with the rest of the program
>
> You can do this:
>
> jsr prtstr call the print string subroutine which pulls the address of the string from the
> fcs /text string/ program counter which was just pushed to the stack
> lda #?? continue with the rest of the program
>
> The prtstr routine can change the program counter as it is saved on the stack so that when the routine returns, it returns to the point just past the end of the string. This optimizes for size by eliminating the need to load the pointer each time you print. It also reduces complexity because you don't need to assign a label to the string.
>
>
>
>
> On 9/15/2017 9: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/>
>>
>> Cheers,
>> Glen
>>
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
More information about the Coco
mailing list