From mint-bounce@lists.fishpool.fi  Tue Apr 28 09:20:49 2009
X-Spam-Summary: 2,0,0,42cd9d364ff5df78,e5c454a4b6f90daf,rfburrows@ymail.com,mint@fishpool.com,RULES_HIT:355:379:541:599:601:945:973:988:989:1260:1261:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1766:1792:2393:2553:2559:2562:2915:3027:3352:3622:3865:3866:3867:3868:3869:3870:3871:3872:3873:3876:3877:4361:5007:6114:6119:7652:7903:8501:8531,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fu,MSBL:none,DNSBL:none
From: "Roger Burrows" <rfburrows@ymail.com>
Organization: Anodyne Software
To: "[MiNT] Mailing-List" <mint@fishpool.com>
Date: Sun, 26 Apr 2009 17:07:25 -0400
MIME-Version: 1.0
Subject: Re: [MiNT] Program start up
Message-ID: <49F494CD.12010.17702E@rfburrows.ymail.com>
Priority: normal
In-reply-to: <C61992CD.166B4%atari@bright.net>
References: <C61992CD.166B4%atari@bright.net>
X-mailer: Pegasus Mail for Windows (4.41)
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
X-session-marker: 616E6F64796E654078706C6F726E65742E636F6D
X-ecartis-version: Ecartis v1.0.0
Sender: mint-bounce@lists.fishpool.fi
Errors-to: mint-bounce@lists.fishpool.fi
X-original-sender: rfburrows@ymail.com
Precedence: bulk
List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
List-Id: <mint.lists.fishpool.fi>
X-List-ID: <mint.lists.fishpool.fi>
List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
List-owner: <mailto:tjhukkan@fishpool.fi>
List-post: <mailto:mint@lists.fishpool.fi>

Hi Lonny,
On 26 Apr 2009 at 4:25, Lonny Pursell wrote:
> 
> I spent some time looking through the cvs files as did Pep for some info
> regarding program startup.  I know 4(sp) points to the basepage, and a0
> points to a basepage if it's a desk accessory. Pep had some other info:
> 
> a6 holds a copy of the stack
> a5 points to the data segment
> a4 points to the bss
> 
> However, we could not find anything to verify these. Anyone know where to
> look in the CVS? Or a doc somewhere?  Or just don't rely on these?  :)
> 

AFAIK, the only things you can rely on when you receive control (i.e. at the 
first byte of the text segment) are:
1) if a0 is non-zero, you are being called as a DA.  a0 points to the program 
basepage; otherwise
2) you are being called as a program and 4(sp) points to the basepage.

You can get the address of the bss & data segments from the basepage.

Regards,
Roger


