English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 16 September 2020, 09:39   #1
litwr
Registered User

 
Join Date: Mar 2016
Location: Ozherele
Posts: 168
how can I save some stack space?

I have found out that the vanilla A500 doesn't support system calls working with filename patterns. So I have written a small library which can be used with any Amiga. Some functions in this library are recursive so I have to think how to reduce the stack load. The best way I know is to save only 16-bit data of pointers. So instead of a plain MOVEM.L I use
Code:
     suba.l a3,a2
     suba.l a3,a4
     suba.l a3,a5
     movem.w a2/a4/a5,-(sp)
     bsr parse
     movem.w (sp)+,a2/a4/a5
     adda.l a3,a2
     adda.l a3,a4
     adda.l a3,a5
where A3 is my basereg. It works but I am looking for a better way. Maybe someone knows some other good tricks for this? Thank you.
litwr is offline  
Old 16 September 2020, 12:47   #2
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 52
Posts: 1,212
Quote:
Originally Posted by litwr View Post
I have found out that the vanilla A500 doesn't support system calls working with filename patterns. So I have written a small library which can be used with any Amiga. Some functions in this library are recursive so I have to think how to reduce the stack load. The best way I know is to save only 16-bit data of pointers. So instead of a plain MOVEM.L I use
Code:
     suba.l a3,a2
     suba.l a3,a4
     suba.l a3,a5
     movem.w a2/a4/a5,-(sp)
     bsr parse
     movem.w (sp)+,a2/a4/a5
     adda.l a3,a2
     adda.l a3,a4
     adda.l a3,a5
where A3 is my basereg. It works but I am looking for a better way. Maybe someone knows some other good tricks for this? Thank you.
Better dont use movem.w for address registers, because it will be good works only for maximum 15 bits values.

I dont know size of your a2/a3/a4 registers, but for your example, i will use next code:
bsr.w parse
lea xx(a3),a2
lea yy(a3),a4
lea zz(a3),a5
Don_Adan is offline  
Old 18 September 2020, 19:47   #3
litwr
Registered User

 
Join Date: Mar 2016
Location: Ozherele
Posts: 168
Thank you. It seems there are no easy ways to get less stack loading.
litwr is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
What order does Exec save the registers on the stack during a context switch? bloodline Coders. General 2 21 February 2017 18:33
How much stack space do we need? AGS Coders. System 3 18 March 2015 17:00
Space Quest III - save game issue - WHDLoad dJOS support.Games 7 18 October 2012 02:45
Would this save disk space? Djay Coders. General 4 03 August 2010 00:00
Balkanski Konflikt, Save the Earth & Space Checkers tomcat666 request.Old Rare Games 10 04 March 2009 10:46

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 00:19.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.08643 seconds with 14 queries