[Coco] Optimizing 6809 Assembly Code: Part 2 – Speedup Storing Data – Unrolling Loops
L. Curtis Boyle
curtisboyle at sasktel.net
Sat Sep 16 10:55:39 EDT 2017
Oh, way slower than a JSR for the reasons you state. But a good way to make subroutine calls where you need to save most/all registers. A lot of the debuggers for the 6809 use one of the SWI calls to do debugging.
L. Curtis Boyle
curtisboyle at sasktel.net
> On Sep 16, 2017, at 8:51 AM, Glen Hewlett <glen.hewlett at sympatico.ca> wrote:
>
> Hi Curtis,
>
> I haven’t used software interrupts in my code before but I see what you are saying here. Is a SWI2 faster then a JSR? I guess the software interrupts will be slower since they always push all the registers on the stack just like the regular IRQ does.
>
> Thanks for the info - Mr. OS9 :)
> Glen
>
>> On Sep 16, 2017, at 1:27 AM, L. Curtis Boyle <curtisboyle at sasktel.net> wrote:
>>
>> 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
>>>
>>
>>
>> --
>> 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