What does PUSHJ do?

Johnny Billquist bqt at Update.UU.SE
Thu May 12 03:30:31 CDT 2005


On Wed, 11 May 2005 Allison <ajp166 at bellatlantic.net> wrote:

> >Subject: What does PUSHJ do? (was Re: was "C on the PDP-8 ... ")
> >   From: spc at conman.org (Sean 'Captain Napalm' Conner)
> >   Date: Wed, 11 May 2005 17:43:49 -0400 (EDT)
> >     To: cctalk at classiccmp.org
> >
> >It was thus said that the Great Brad Parker once stated:
> >>
> >> heh.  I remember puzzling at the the "pushj"'s and "popj"'s in the FOCAL
> >> source code.  This was before I had seen a pdp-11 or dec-10.
> >
> >  What does PUSHJ actually do?  I remember reading about it in Steven Levy's
> >Hackers, but never got what was so special about it.
> >
>
> It's a PAL macro for push and jump and there is a return and pop.

Not to mention the fact that on the PDP-10 there actually was the
instructions PUSHJ and POPJ, which probably was the inspiration for the
macros on a PDP-8.

The PDP-10 is a fun architecture. You can do subroutine calls in all the
paradigms available. Stack? Sure. Return address at the start of the
routine? Sure. Return address in a register? No problem.

> Come from the fact that PDP-8 put the return address at the called location and the next
> location is executed.
>
> MAIN  ; do something
>       JMS   I,FOO
>       ; more something
>
>
> FOO   ; return stored here
>       Add I,BLAH
>       JMP I,FOO
>
> In PDP-8 the I in the addressing is use the contents at the address
> pointed to.

Not a good example. It should really be JMS FOO, and at the label FOO you
need to place a 0, which is overwritten by the return address. (What
assembler do you usually use, btw? Comments come after a slash... :-) )

> Now if you want recursion
>
> You call a standard call and return routine (COSMAC 1802 requires this too).
>
> The routine gets the target address(work routine) and the return adddress
> (caller) and saves the return and dispatches to the work routine.  The
> reverse is done to get back to the originating caller.

Yup.

> In the PDP-8A and 6120 there are IOTs to push/pop the ACC on the stack
> and and also there are a set of push/pops for the PC register.

Eh? No. The PDP-8/a don't have any stack IOT. Same set as the 8/e. The
only difference is how some illegal combinations of OPR instructions act.
The CPU deals with almost no IOTs itself. You then have the KK8A and
DKC-8AA which handles most IOTs of the machine which are considered to be
built in.

> However the PDP-8 programmer is less likely to use a stack than a
> flavor of computed jump or call.  PDP-8 is good candidate for an
> state machine coding.

Of course, since there isn't any stack in hardware.

	Johnny

Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt at update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


More information about the cctalk mailing list