I’m most definitely not the best person to answer this — and I’m sure someone will provide a better answer. But….
There is not “a stack” for the PDP-10. However, any application can allocate some stack space (array or 36-bit words) and initialize a PDP-10 register to hold an AOBJN pointer (see later) to the base of the stack. Then, stack-based calls can be done with the PUSHP SP, instructor and returns can be done with the POPJ SP, instruction, where SP is defined as the register that points to the stack. Register 17 is frequently used as the stack pointer for an application (although this is not required). There is nothing stopping a PDP-10 program from having more than one stack and using more than one register for stack pointers.
One of the first things a PDP-10 program that uses a stack must do is set up the stack. Assuming you have allocate some space in your program for the stack, frequently called a “PDL” (push down list), and assuming that this location is memory is located at the symbol PDL and that the stack length you allocated is defined by the constant PDLLEN, then you do this to initialize your stack pointer:
MOVE SP,[-PDLLEN,,PDL]
This sets up an AOBJN pointer, where the negative length (-PDLLEN) is in the left half (LH) of a word, and the top-of-stack is located in the right half (RH).
Now, you can call your subroutines with:
PUSHJ SP, FOO
Where FOO is the subroutine. That subroutine can return with:
POPJ SP,
The PUSHJ SP, FOO instruction will first add 000001000001 (base 8) to the memory referenced by SP. If the LH of SP goes to zero, the Pushdown Overflow flag will be set. Then PUSHJ will place the address of the next instruction (the return address), into the RH of SP. If will then JUMP to the address of FOO.
The increment of both halves of SP will set things up for the next PUSHJ or POPJ.
The POPJ SP, instruction will take the return address from the location addressed by the RH of SP (and hang onto it until the stack is adjusted). Then it will subtract 000001000001 from the memory addressed by SP. If this causes the LH of SP to go to -1, the Pushdown Overflow flag will be set. Then the POPJ instruction will cause a transfer to the address retrieved prior to the decrement.
I’ve written the above from memory and haven’t programmed in assembly on a PDP-10 for many months, so I may have messed up the description in some way. I’m sure someone else will correct me if I did.
The main takeways are that there isn’t a single stack, but any program is free to define one or more stacks (usually one), and then use the PUSHJ and POPJ instructions to “call” and “return” from subroutines.
Oh, I forgot to give an example of allocation stack space in the program:
pdllen==100. ;this is how deep the stack should be
100 words are allocated at the address specified by PDL.
— Eric