Date: Tue, 30 Sep 1997 10:47:32 +1100 From: Bill Currie Subject: Re: DJGPP humor: lightyr.s (long long) In-reply-to: <60er9u$5qp$2@vnetnews.value.net> To: "M. Schulter" , djgpp AT delorie DOT com Message-id: <199709292252.KAA06121@teleng1.tait.co.nz gatekeeper.tait.co.nz> Organization: Tait Electronics Limited MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Comments: Authenticated sender is Precedence: bulk On 25 Sep 97 at 23:15, M. Schulter wrote: > Thanks to Andrew Crabtree for a suggestion I used in revising this > program: using a variable _stacksave to restore the value of %esp at > the end rather than reseting it after every printf. I'd be curious Ugh (no offense), but that feelse dangerous to me. You'ld be better off (IMHO) to do the following (allows for nested calls): _main: pushl %ebp movl %esp,%ebp ; code, unfortuantly, %ebp has just been lost, but it's ; usually not needed anyway ; ... leave ; equivalent to movl `%ebp,%esp; popl %ebp' ret In fact, this is how gcc does it. > to learn, by the way, if there's any guideline in more ambitious > programs on how large one should allow the stack to grow, or how > often one should restore %esp. Go by your instincts. Remember, you have 256k (default) for your stack. That's a LOT of functions calls. Bill -- Leave others their otherness.