[Coco] Pop PC with empty stack?

Aaron Wolfe aawolfe at gmail.com
Tue Apr 6 00:20:16 EDT 2010


On Tue, Apr 6, 2010 at 12:08 AM, Lothan <lothan at newsguy.com> wrote:
> I'm hoping someone can help refresh my memory on the internals of OS-9. Specifically, I'm seeing this code:
>
>  PSHS Y
>  ...
>  PSHS X
>  ...
>  LDA ,-X
>  CMPA #$30
>  BCS L016C
>  CMPA #$39
>  BHI L016C
> ...
> L016C LDD 2,U
>  PULS X
>  PULS Y,PC
>
> That it's popping X and Y from the stack makes perfect sense because those two registers were pushed onto the stack previously. At this point the stack should be empty, so what happens when it attempts to pop PC from the stack? Is this effectively the same as OS9 F$Exit?
>

pulling PC is like RTS, but its more efficient to do it along with
other regs if you have them on the stack as well.  chances are that
code was called as a subroutine (which put the return address on the
stack).

> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>



More information about the Coco mailing list