[A83] Re: "forget" ret with calls ?


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

[A83] Re: "forget" ret with calls ?




Sorry, just to be sure, is it


Like this:


  ld (stackvar),sp
  call some_code



some_code:
   ;code

   ld sp,(stackvar)
   ret    ;return to TI-OS

;--------------------------------------

Or like this:
   call some_code

some_code:
   ld (stackvar),sp
  ;code


return_OS:
   ld sp,(stackvar)
   ret


???






>From: Peter-Martijn Kuipers <hyper@@hysoft-automation.com>
>Reply-To: assembly-83@lists.ticalc.org
>To: assembly-83@lists.ticalc.org
>Subject: [A83] Re: "forget" ret with calls ?
>Date: Fri, 28 Dec 2001 20:29:33 +0100 (CET)
>
>
>Simple,
>
>pop a variable, directly after the label you called to, and you're in 
>business.
>though this only works if you haven't popped any vars on the stack before
>calling
>
>another approach (safer!!) is:
>store the stack pointer to a safer location.
>restore the stack pointer before calling...
>
>at the start:
>ld (stackvar),sp ; stackvar is a locationyou choose to be somewhere in 
>saferam
>
>at the place you want to exit:
>ld sp,(stackvar)
>ret
>
>--Peter-Martijn
>
> >
> >
> > Is it possible to make the calc "forget" it was busy doing a call, so 
>that
> > when a ret command is given in a call the program returns to the TI-OS
> > rather than returning to the place where the call was made?
> >
> > Thank you,
> >
> >     Hasan Güdük
> >
> >
> >
> > _________________________________________________________________
> > Join the world’s largest e-mail service with MSN Hotmail.
> > http://www.hotmail.com
> >
> >
> >
>
>
>




_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com





Follow-Ups: