Re: A83:'ret'


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

Re: A83:'ret'




RET uses the stack, it just pops the program counter.  Make sure you count 
your pushes and pops, because the stack is not infinate.

If you want a nice bail-out feature, do this somewhere in the code 
(beginning):

  ld (BackupSP),sp

And when quitting, just 'jp Quit'.  This restores the stack and returns.

Quit:
  ld sp,(BackupSP)
  ret

(You need a variable called BackupSP, use this:)
BackupSP: .dw 0


>From: "Jan (belgacom)" <jandebeule@belgacom.net>
>Reply-To: assembly-83@lists.ticalc.org
>To: "TI-83 assembly-83" <assembly-83@lists.ticalc.org>
>Subject: A83:'ret'
>Date: Mon, 29 Jan 2001 20:58:22 +0100
>
>If you use a lot of 'push' and 'pop' during a program, your calculator can
>easily crash when trying to exit the program with the usual 'ret'(i'm
>writing for ION btw, but i don't think that has an influence)
>Is there a way of avoiding crashes or do you just have count how many times
>you pushed a register and then pop it as many times? (and that's not so
>easy! So i hope there is another way...)
>
>Greats, Vladimir
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com