Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site x.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!houxm!whuxl!whuxlm!akgua!sdcsvax!dcdwest!ittvax!decvax!genrad!mit-eddie!cybvax0!frog!x!john
From: john@x.UUCP (John Woods)
Newsgroups: net.unix-wizards
Subject: Re: Curiosity
Message-ID: <409@x.UUCP>
Date: Tue, 26-Feb-85 13:18:20 EST
Article-I.D.: x.409
Posted: Tue Feb 26 13:18:20 1985
Date-Received: Sun, 3-Mar-85 03:54:30 EST
References: <8502@brl-tgr.ARPA> <408@x.UUCP>
Organization: Charles River Data Systems, Framingham MA
Lines: 42

Having gone home and gotten a USEFUL Processor Handbook (pdp11/45, 1973,
back when computers were REAL computers), I beg to correct and supplement
my MARK posting:

SP <- PC + 2xNN		NN = number of parameters
PC <- R5
R5 <- (SP)^		(The + wasn't spurious, the NN was; see 408@x)

TO USE THIS BEAST (oh my God, you mean you *can*?):

	; subroutine calling sequence:
	MOV	R5,-(SP)		; place old R5 on stack
	MOV	parm1,-(SP)		; place N parameters
	MOV	parm2,-(SP)		; on the stack to be used
	...				; for the subroutine's
	MOV	parmn,-(SP)		; nefarious purposes
	MOV	#MARKN,-(SP)		; place MARK N on the stack
					; of all places!
	MOV	SP,R5			; point R5 to that MARK instruction
	JSR	PC,SUBROUTINE

SUBROUTINE:
	;;;;;;;;;
	RTS	R5			; returns to MARK N, which pops
					; crud off the stack, then pops
					; R5 off the stack.  The return address
					; on the stack went briefly into
					; R5, and then straight into the PC.

Now, wasn't that simple?

Just remember, this is (nearly) useless with separate I/D spaces, so it
is interesting that the 11/45 handbook told me about it.

Now, does anyone want to start a roaring flame session about how the
information in DEC handbooks is a decaying exponential in time...:-?

-- 
John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101
...!decvax!frog!john, ...!mit-eddie!jfw, jfw%mit-ccc@MIT-XX.ARPA

Sorry, I don't feel deep right now.