<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sat, 16 Oct 2004 09:56:40 -0700
From   : Angus Duggan <angus.duggan@...>
Subject: RTS

Andrew W writes:
>Does RTS return from a subroutine such as:
>.YSIX RTS
>to after the branch instruction or does it return to basic? I thought
>it was the former although the routine I'm trying to implement won't
>seem to go past a particular subroutine. After the RTS I think it is
>going back to BASIC. The calling code is:
>CPY #5:BEQ YSIX
>after which I can't seem to get anything to work! 

RTS returns to the location set up by JSR on the stack. You have branched to
it, not called it as a subroutine. The entry point from BASIC to machine code
(CALL) is implemented as a JSR to the address given by the argument, so RTS
will return to BASIC if no other sub-routines have been called.

a.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>