[comp.sys.atari.st] May I overwrite basepage

to_stdnet@stag.UUCP (04/04/89)

From: BROOKS%csss-a.prime.com@RELAY.CS.NET

Sometimes I write very small stay-resident programs and, instead of
allocating 2K of bss for an stack (and then only using 250 bytes) I set
up the stack to overrun my startup code and wander down into the
basepage.

Does anyone know: Will this cause any problems?  Does TOS need anything
in the basepage one I've started executing -- providing I don't Pexec
anything?  Of course, I'd better not go *below* the basepage...
------------------------------------------------------------------------

David Brooks   Internet:       BROOKS@CSSS-A.PRIME.COM
               uucp:           {mit-eddie,uunet}!csss-a.prime.com!brooks

Signature on file.           Standard disclaimer applies as appropriate.

apratt@atari.UUCP (Allan Pratt) (04/05/89)

In article <766@stag.UUCP> to_stdnet@stag.UUCP writes:
> From: BROOKS%csss-a.prime.com@RELAY.CS.NET
> 
> Sometimes I write very small stay-resident programs and, instead of
> allocating 2K of bss for an stack (and then only using 250 bytes) I set
> up the stack to overrun my startup code and wander down into the
> basepage.
> 
> Does anyone know: Will this cause any problems?  Does TOS need anything
> in the basepage one I've started executing -- providing I don't Pexec
> anything?  Of course, I'd better not go *below* the basepage...

You'd better not go INTO your basepage, at least not past your command
line (which starts at offset $80 in your basepage).  GEMDOS needs to use
the basepage (not surprisingly), so you can't make any GEMDOS calls
after you clobber your basepage.  The GEMDOS call Ptermres, which you
obviously are using, definitely needs stuff in your basepage, like your
parent's basepage address so it can restart your parent.  You can
clobber your own command line area and the part of the TPA beyond that,
but leave the rest of your basepage alone. 

Do NOT take the example I gave above and think, "Oh, if I preserve the
parent's basepage value in my basepage, I can use the rest of it." It is
intended as an example, not an exhaustive list, of what GEMDOS needs
from your basepage. 

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt

leo@philmds.UUCP (Leo de Wit) (04/11/89)

In article <1430@atari.UUCP> apratt@atari.UUCP (Allan Pratt) writes:
|You'd better not go INTO your basepage, at least not past your command
|line (which starts at offset $80 in your basepage).  GEMDOS needs to use
|the basepage (not surprisingly), so you can't make any GEMDOS calls
|after you clobber your basepage.  The GEMDOS call Ptermres, which you
|obviously are using, definitely needs stuff in your basepage, like your
|parent's basepage address so it can restart your parent.  You can
|clobber your own command line area and the part of the TPA beyond that,
|but leave the rest of your basepage alone. 

And if you plan to use GEMDOS functions like Fsfirst/Fsnext (that use a
DTA: disk transfer address) without setting up your own DTA (Fsetdta if
I'm correct), you'd probably not want to clobber the command line area
either. Last time I looked the default value for the DTA (a pointer in
the basepage) was set up to point to just this area.

    Leo.