[Coco] lbsr and rts

jdaggett at gate.net jdaggett at gate.net
Wed Sep 16 17:53:19 EDT 2009

On 16 Sep 2009 at 10:46, Wayne Campbell wrote:

> I may be missing something, but I thought calls to subroutines required a
> rts instruction. In Basic09, there has to be a RETURN statement for any
> given GOSUB, but not necessarily one-for-one. I can, for example, have a
> series of subroutine calls, where there are multiple entry points for the
> subroutine, and one RETURN statement, like:


Both LBSR and BSR stack the PCR only. 

In some instances where you wish to pass variables back to the calling program by 
leaving them on the stack. You can do a stack manipulation by moving the pointer to the 
return address location on the stack and then do a puls(u) pcr instruction. 



More information about the Coco mailing list