The answer to your question is fairly obvious if you have studied the code ! If you look at the bottom of setregs, the PC is set to the entry point for the code. Thus when you return from the call with an RTI, user execution commences at the new PC. Why does that particular section strike you as a treasure hunt ??!! Perhaps you need to 'C' things better !!