[Coco] Optimizing 6809 Assembly Code: Part 2 – Speedup Storing Data – Unrolling Loops
L. Curtis Boyle
curtisboyle at sasktel.net
Sat Sep 16 01:27:04 EDT 2017
This is actually similar to how system calls in (Nitr)OS-9 work as well, although they use SWI2 (Software Interrupt 2) calls instead of JSR (that automatically puts all registers on the stack). The byte right after the SWI2 is the system call token itself, and the system call handler in the kernal loads that byte to figure out which system routine to jump to.
L. Curtis Boyle
curtisboyle at sasktel.net
TRS-80 Color Computer Games website
http://www.lcurtisboyle.com/nitros9/coco_game_list.html
> On Sep 15, 2017, at 9: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