Deutsch   English   Français   Italiano  
<mddh69v33qt.fsf@panix5.panix.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder9.news.weretis.net!panix!.POSTED.2602:f977:0:1::5!not-for-mail
From: Rich Alderson <news@alderson.users.panix.com>
Newsgroups: alt.folklore.computers,comp.os.linux.misc
Subject: Re: The joy of FORTRAN-like languages
Followup-To: alt.folklore.computers
Date: 01 Oct 2024 17:36:10 -0400
Organization: PANIX Public Access Internet and UNIX, NYC
Lines: 58
Sender: alderson+news@panix5.panix.com
Message-ID: <mddh69v33qt.fsf@panix5.panix.com>
References: <pan$96411$d204da43$cc34bb91$1fe98651@linux.rocks> <vd8o1s$178gk$5@dont-email.me> <llr46dFmeudU2@mid.individual.net> <vd9r10$1d6gq$4@dont-email.me> <vd9rub$18mq$2@gal.iecc.com> <vd9see$1d6gq$5@dont-email.me> <AF4KO.179529$1m96.177503@fx15.iad> <vdarvh$1l4ch$6@dont-email.me> <mddbk046f1m.fsf@panix5.panix.com> <IdGKO.416688$_o_3.231003@fx17.iad>
Injection-Info: reader1.panix.com; posting-host="2602:f977:0:1::5";
	logging-data="5771"; mail-complaints-to="abuse@panix.com"
X-Newsreader: Gnus v5.7/Emacs 22.3
Bytes: 3360

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