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.
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.
I recall a similar issue with the Siemens 306, their first stack-based
machine, round about 1975. They had function call and return
instructions which manipulated the stack pointer, but it seemed that
nobody used them: they didn't work. From memory, the call instruction
incremented the stack pointer and stored PC. The return call
instruction decemented the stack pointer and loaded PC--from the wrong
location.
I never used the 306 myself, but I often wondered if they modified one
of the instructions to DTRT.
Greg
--
Sent from my desktop computer.
Finger grog(a)FreeBSD.org for PGP public key.
See complete headers for address and phone numbers.
This message is digitally signed. If your Microsoft MUA reports
problems, please read
http://tinyurl.com/broken-mua