[A83] Re: returning to OS in call routines


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

[A83] Re: returning to OS in call routines



At 10:49 PM 8/7/2003 +0200, you wrote:
>i  write often call routines and also call routines in call routines. In one
>of these routines i want to check if the "clear-button" is pressed and if so
>then program should exit. And for this you usually use "ret" but this would
>exit the routine?! So how to return to OS from a routine? Impossible?
>Thanks

If you save the stack pointer at the beginning in the program and set it 
back when you want to exit the program you can just use a normal ret. To 
save the stack pointer you need to bytes of free ram and use this code ld 
(saferam),sp and ld sp,(saferam) .

Hope this helps, Martin 




References: