[Coco] 6809 Push/Pull

Jim OKeefe jimokeefe39 at gmail.com
Sat Jun 6 14:46:30 EDT 2020


What got me thinking and why i asked the question originally was while
looking for some code in Color Basic Unravelled i came across

PSHS X,B,A
bla
bla
bla
PULS A,B,X,PC

I knew the PC was a return but why reverse the order of X B and A.  I
looked for other examples in the book and found the same thing.  It appears
that this format was used through out the book. That's when i freaked out.
I thought how could my code not be crashing like crazy and asked the list
the original question,  lol. After seeing Art's answer i said to myself,
"i knew that".  Memory is a cruel maiden indeed.

Thank you all for a good discussion.

Jim

On Sat, Jun 6, 2020, 12:58 PM Dave Philipsen <dave at davebiz.com> wrote:

> Well, for its intended usage of pushing/pulling registers to the stack,
> it's the way you want it to be. For instance, it's easy to see why the
> PC should be the first pushed and last pulled. It's also easy to see why
> B should be pushed before A.
>
> I'm sure you could find some obscure corner cases where you might want
> it to do otherwise. But the way it's done is the most logical way and
> you'd have a hard time convincing me it should be done any other way.
>
>
> Dave
>
>
> On 6/6/2020 7:32 AM, Bill Gunshannon wrote:
> > On 6/6/20 7:40 AM, Dave Philipsen wrote:
> >> Which is the only way that makes any sense, pull in the opposite
> >> order that you pushed. Any other way would not make sense.
> >>
> >
> > Depends on what you are trying to do.  :-)
> >
> > bill
> >
> >
>
> --
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list