On 2016-01-06 00:04, Greg 'groggy' Lehey wrote:
On Tuesday, 5 January 2016 at 21:35:47 +0100, Johnny
Billquist wrote:
On 2016-01-05 18:43, Ronald
Natalie<ron(a)ronnatalie.com> wrote:
Just never figured out how to make good use of the MARK instruction on the PDP-11.
Not surprising. As others noted, few ever did. And apparently none
responding actually do either.
It *is* a stupid instruction in many ways. And it's not for multiple
returns either.
It's an odd way of handling stack cleanup without a frame pointer.
Thanks for the (omitted) explanation. At first sight, the instruction
almost seems to make sense for functions with a variable number of
parameters, but of course there are simpler ways to do it.
Definitely. Like how most compilers do - the caller cleans the stack
afterwards, if we have a system where a variable number of arguments are
allowed and not indicated in other ways. Not to mention explicit
cleaning up of the stack in the function before the return as well.
I wonder if this is a case of "it sounded like a
good idea at the
time" (when the instruction set was being designed), and it took a
while for people to realize that it wasn't of any use.
Probably not. This ties in with an old (urban) myth about the PDP-11.
The MARK instruction was not in the basic, original instruction set. It
came about in one of the extensions that were done. And one story behind
it was that it was "invented" in order to copyright, or somehow protect
the instruction set for a few years more.
(I think it came at the same time as SOB, and the EIS stuff, but I don't
remember for sure...)
Johnny
--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: bqt(a)softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol