🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #32218

Re: BITNET mail follows

#32218
From: Leo de Wit
Date: Thu, 28 Apr 1988 10:48
52 lines
3049 bytes
In article <8804200802.AA03159@ucbvax.Berkeley.EDU> 0ALEVI@POMONA.BITNET writes:
>Bill writes:(Bill Rosenkranz)
>>Mshrink is a gemdos call that returns memory to the operating system. a far
>>[...middle of article deleted...]
>>first. you should probably solicit a response from lattice hackers.
>Bill,
>     What you said makes perfect sense.  I even think it will help!  But,...
>what are the two parameters to the Mshrink(a,b) call?  Do you know? Are these
>universal to all compilers?  Does the function return a value (such as an
>error code)?
>[...middle of article deleted...]
>Alan Levi

    Here is an answer from a Lattice hacker: In Lattice the linking process
starts with a INPUT startup.bin. This module does indeed a Mshrink. As far as
I remember without having the documentation with me, this is equivalent with
a gemdos 0x4a call: setblock. It takes two parameters, the first the block's 
start adress, the second the block's size. I don't know, but I think Mshrink
returns a -1 on fail and 0 on success (the standard gemdos return values). All
decent C compilers for the ST should offer the Mshrink function in some way;
Lattice does it by a macro definition that uses a function gemdos().
    Typically the start address is
the address of the base page, the length is the sum of the text, data, bss,
spare and stack segments. You should obtain a copy of Data Becker's Atari St
Intern, the gemdos calls are, if not very superfluous, explained there.
Startup.bin takes standard all memory but 4K (that four K is for stuff like 
.RSC files!). You can however overrule this by assigning to the external variable _mneed, e.g.:

int _mneed = 10240;

main()
{
....
}

As far as I understand it, the size of the spare room (above the bss, under 
the stack space) is now set to 10240. This spare room is typically used for mallocs etc. (the C mallocs, not the gemdos call!).

For the stack something similar applies: the standard stack size is 2K, this is
adequate if you don't do too weird things. You can overrule this by, analoguous
to the _mneed variable, assigning to the variable _stack. Note that there are
no checks against the stack overrunning the data space, so you should indeed
use this variable when you need lots of stack space (sbrk will only allocate
till the bottom of the stack segment).

All this talk about _mneed and _stack you should be able to find in your Lattice manual. It also says that you always must link with startup.bin; this is not
quite true; I have managed to link without it; it saves you K's!
If you are interested, I'll describe how (C source).

	Hope you find these hints useful.

		Leo.
Technical Details
Message-ID: <471@philmds.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!philmds!leo
References: <8804200802.AA03159@ucbvax.Berkeley.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!philmds!leo
From: leo@philmds.UUCP (Leo de Wit)
Newsgroups: comp.sys.atari.st
Subject: Re: BITNET mail follows
Message-ID: <471@philmds.UUCP>
Date: 28 Apr 88 10:48:30 GMT
References: <8804200802.AA03159@ucbvax.Berkeley.EDU>
Reply-To: leo@philmds.UUCP (L.J.M. de Wit)
Organization: Philips I&E DTS Eindhoven
Lines: 52