Re: A86: Push/Pop Stack


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

Re: A86: Push/Pop Stack



David Piper wrote:
> 
> I have two questions about pusing and poping.
> 
> If I have the following routine
> 
> push af
> call _getkey    ;check for key press
> pop af
> 
> What happens with the stack if the user pesses 2nd on?  It returns back
> to the home screen,  so does that automaticaly fix any pop's that have
> not taken place.

yep it pops the stack until the sp is 0

> 
> 2nd of all when is the stack restrored to default (like if you have a
> program that messed it up and you wanted to fix it)
> 
> Possibilities:
> 1.  Exit of Program
> 2.  When the Calc is turned off, then back on
> 3.  Reset Defaults
>  4. Reset mem
>  5. Reset all
> Which one is it (if any)?

if it messes up the stack chances are it will crash the calc (most of
the time its because you pop before you push)


References: