MIT PDP-10 'Info' file converted to Hypertext 'html' format by Henry Baker

Previous Up Next

Obsolete and not-recommended jump instructions: JSR, JSP, JSA and JRA

The JSR and JSP instructions are two non-stack subroutine calls which are typical of most non-stack machines. JSP stores the old PC in an accumulator, and JSR stores it in a word at the beginning of the subroutine. JSP is useful once in a while, such as, for a subroutine whose job is to push or pop several words on the stack. JSR is useful only for UUO-handlers. *Note JSR: UUO Handlers. PUSHJ and POPJ should be used for all ordinary subroutines.

JSA and JRA are a peculiar subroutine call and matching return which were invented for PDP-6 Fortran. In most programs they are not used at all.

JSR     C(E)<-<flags,,PC>; PC<-E+1;
JSR, Jump to SubRoutine, stores the PC in the word addressed by the effective address and jumps to the word following the word where the PC is stored. This is the only PDP-10 instruction that stores the PC and flags without modifying any ACs; however, it is non-reentrant, so PUSHJ is favored in most cases. The usual return from a subroutine called by a JSR is via JRST (or JRST 2,) indirect through the PC word. (See JRST)
JSP     C(AC)<-<flags,,PC>; PC<-E;
JSP, Jump and Save PC, stores the PC and flags in the selected accumulator and jumps.
JSA     C(E)<-C(AC); C(AC)<-<E,,PC>; PC<-E+1;
JSA, Jump and Save AC, stores the AC in word addressed by the effective address. Then the left half of the AC is set to the effective address and the right half of AC is set to the return PC. Then the PC is set to one greater than the effective address. The JRA instruction unwinds this call. The advantage of this call is that a routine may have multiple entry points (which is difficult to do with JSR) and it's easy to find (and later to skip over) arguments that follow the calling instruction (which is possible to do with PUSHJ, but not quite so convenient). Among the disadvantages of this call is that it is non reentrant, and it doesn't save flags.
JRA     C(AC)<-C(CL(AC)); PC<-E;
JRA, Jump and Restore AC, is the return from JSA. If, e.g., a subrountine is called with JSA AC, then the return is made by:
        JRA AC,(AC).