Sujet : Re: The joy of FORTRAN-like languages
De : news (at) *nospam* alderson.users.panix.com (Rich Alderson)
Groupes : alt.folklore.computers comp.os.linux.miscSuivi-à : alt.folklore.computersDate : 01. Oct 2024, 22:36:10
Autres entêtes
Organisation : PANIX Public Access Internet and UNIX, NYC
Message-ID : <mddh69v33qt.fsf@panix5.panix.com>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Gnus v5.7/Emacs 22.3
scott@slp53.sl.home (Scott Lurndal) writes:
Rich Alderson <news@alderson.users.panix.com> writes:
Or actual machine instruction codes, as on the PDP-6 and PDP-10:
PUSH ac,address ;any accumulator can be a stack pointer
POP ac,address
PUSHJ ac,address ;address of next instruction on stack, jump to address
POPJ ac, ;pop address from stack and jump to it
There are also subroutine call instructions which do not use a stack, instead
using either the "save return address in first instruction of subroutine" or
"save the return address in an accumulator". The former is nonreentrant; the
latter allows placing parameters inline, with address manipulation via indexing
to access and later skip over them.
PDP-8, as I recall.
If you're thinking that I made an error, no. All of these exist in the
instruction set for the 36 bit line. I'm sorry if it was not clear that I was
only discussing actual instructions in that architecture:
JSR M ;jump to subroutine
stores return address at location M and begins execution at M+1, with return
via indirection (JRST @M); the AC field must be 0.
JSP AC,M ;jump and save PC
puts return address in accumulator (register) AC and begins execution at M,
with return via indirection (JRST @AC).
The following pair combines the utility of the previous pair and allows for
multiple entry points to a subroutine:
JSA AC,M ;jump and save AC
saves the contents of AC at M, the address M in the left half of AC, and the
current PC in the right half of AC, then jumps to location M+1. Return is via
JRA AC,E ;jump and restore AC
places the contents of the location addressed by the left half of AC into AC
and jumps to location E. Because the original PC can be obtained by indexing
off of the accumulator AC, E can be specified as 1(AC) to return to the next
instruction after the JSA, because effective addressing is done before the AC
is disturbed.
PDP-8 only used the "store return address in the first location of the subroutine"
regimen, as you note.
-- Rich Alderson news@alderson.users.panix.com Audendum est, et veritas investiganda; quam etiamsi non assequamur, omnino tamen proprius, quam nunc sumus, ad eam perveniemus. --Galen