What does PUSHJ do? (was Re: was "C on the PDP-8 ... ")

Allison ajp166 at bellatlantic.net
Wed May 11 17:32:37 CDT 2005


>
>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.

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.

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.

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.  The 
general PDP-8 archetecture is very unique in that IOTs are really
a handoff of the CPU core and registers to the device. So it's possible 
for IO hardware to get the PC save it and add a number to it and put 
it in the PC. The EMA is IO hardware.  Oh, and they can also 
ouput/input from the ACC too.

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.  


Allison



More information about the cctalk mailing list