Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!apple!bloom-beacon!eru!luth!sunic!draken!d88-eli From: d88-eli@nada.kth.se (Erik Liljencrantz) Newsgroups: comp.lang.pascal Subject: Re: Alien programs within TP5 Keywords: Turbo-Pascal alien/external programs Message-ID: <1770@draken.nada.kth.se> Date: 25 Sep 89 21:26:54 GMT References: <1323@rwthinf.UUCP> Reply-To: d88-eli@nada.kth.se (Erik Liljencrantz) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 33 In article <1323@rwthinf.UUCP> pmk@cip-s08.informatik.rwth-aachen.de (Michael Keukert) writes: >In my application (starting various sub-programs within one, hmm, let`s call >it "program-server") I used all the following options: >{$M 51200,0,0} >{$M 1024,0,0} >{$M 4096,0,0} >and I haven`t remarked any differences. > >So if you can explain it once again, I might learn it. In the {$M x,y,z} directive the first number sets the size of the stack. The stack is used to pass parameters to procedures and functions and to store local variables. Recursive routines consumes much stackspace, but also consider a chain of calling procedures, each with a string value parameter = at least 260 bytes stack space for each instance! Also when hardware interupts occurs the stack is used to save the contents of the processor registers. If the stack is to small, you have two options: a. Program compiled with {$S+} detects if you are out of stack space. b. Program compiled with {$S-} doesn't detect it and continues... Guess what happens (sooner or later)... Use {$S+} during development, and remove it if you think your code is stable. In a small program {$M1024,0,0} might be enough, but try it with {$S+} before you do anything serious with it... (For an indept discusion of the stack segment (SS) and the stack pointer (SP) look into a book teaching assembly level programming...) --- Erik Liljencrantz | "No silly quotes!!" d88-eli@nada.kth.se | Embraquel D. Tuta