Re: A83:'ret'
[Prev][Next][Index][Thread]
Re: A83:'ret'
ld (Quit+1),sp
...still jp Quit to exit
Quit:
ld sp,0
ret
In a message dated 1/29/2001 6:04:05 PM Eastern Standard Time,
dwedit@hotmail.com writes:
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
----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org