Re: LZ: User stacks


[Prev][Next][Index][Thread]

Re: LZ: User stacks



On Thu, 8 Aug 1996, Rob Taylor wrote:


> 
> > On Tue, 6 Aug 1996, Eric C. Jensen wrote:
> > 
> > >      Can someone explain how to define your own stacks???  I think I have
> > > some idea, but I don't quite know.  Do you allocate memory and then
> > > allocate a seperate variable to be a stack pointer to manipulate it?
> >  
> > Basically, you decide where you want the new stack to be, and you load
> > it's address in SP and you have a new stack.  You also need to save
> > the old value of SP in most systems, and restore it before your program
> > exits.  I'm not sure if that's true of the TI.
> > 
> yes you need to restore the stack.
> (how else would your final ret return to zshell if you didn't????)


In CP/M programs you terminate your program with JP 0.  There is no
return to CP/M.  When CP/M loads your program it makes no assumptions
about how you return.  You can do a CALL 0 if you choose.  CP/M does a
warm start so nothing is hurt.


Barry


References: