Curiosity

John Woods john at x.UUCP
Wed Feb 27 04:18:20 AEST 1985


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 at 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 at MIT-XX.ARPA

Sorry, I don't feel deep right now.



More information about the Comp.unix.wizards mailing list