	.TITLE COPYRIGHT LEGEND.
/
/ COPYRIGHT (C) 1975
/ DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/ THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/ THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/ SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/ VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/ EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/ THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/ SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/ WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/ MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/ DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/ OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY
/ DEC.
/
	.TITLE PATCH ADDRESSES FOR RSX INTO SYSBLK

	.IODEV -14,-3		/USE IODEVICE ATTACHED TO -14 AND -3

	.DBREL			/USE IN PAGE MODE.

RSXPAT	.INIT -14,0,0		/INIT FOR INPUT.

	.TRAN -14,0,34,BUFF,256	/ READ SYSBLK.

	.WAIT -14		/ WAIT FOR I/O

	JMS .+1			/ START TO CALCULATE MAGIC NUMBER

	XX			/ FOR INDEXING.

	LAC .-1			/ FETCH ADDRESS.

	AND (70000)		/ STRIP OUT PAGE AND BANK BITS.

	CMA!IAC			/ MAKE NEGATIVE.

	TAD (BUFF)		/ CALCULATE BUFFER ADDRESSING.

	PAX			/ SHOVE VALUE IN INDEX REGISTER.

	TAD 0,X			/ ADD IN OFFSET TO FIRST FREE WORD IN

	PAL			/ BUFFER AND PLACE IN LIMIT REGISTER.

	AXS 1			/ POINT TO FIRST NAME IN SYSBLK.

	SKP			/ ARE WE GOING TO FIND "RSXIMG"?

	JMP ERROR		/ NO, GIVE ERROR MESSAGE AND HALT.

SC.LP	LAC RSX			/ FETCH SIXBIT "RSX"

	SAD 0,X			/ NAME THE SAME?

	SKP			/ YES, CHECK SECOND HALF.

	JMP SC.LP9		/ NO, MOVE TO NEXT ENTRY.

	LAC IMG			/ FETCH SIXBIT "IMG"

	SAD 1,X			/ NAME THE SAME?

	SKP			/ YES, CONTINUE.

	JMP SC.LP9		/ NO, MOVE TO NEXT ENTRY.

	LAC (30)		/ FETCH FIRST ADDRESS.

	DAC 4,X			/ SET UP FA IN SYSBLK FOR RSXIMG.

	LAC (70000)		/ FETCH PROGRAM SIZE.

	DAC 5,X			/ SET UP PS IN SYSBLK FOR RSXIMG.

	LAC RSX			/ FETCH "RSX" FOR PROGRAM STARTING ADDR.

	DAC 6,X			/ SET UP SA FOR RSXIMG.

	.TRAN -14,1,34,BUFF,256	/ WRITE MODIFIED BLOCK ONTO SYSTEM DEV.

	.WAIT -14		/ WAIT FOR I/O TO COMPLETE.

	.EXIT			/ RETURN TO BATCH STREAM.

SC.LP9	AXS 7			/ MOVE TO NEXT ENTRY.

	JMP SC.LP		/ DONE YET?
ERROR	.INIT -3,1,0		/ OUTPUT ONLY.
	.WRITE -3,2,MESS,0	/WRITE ERROR MESSAGE.

	.WAIT -3		/ WAIT FOR MESSAGE.

	HLT			/ STOP PROCESSOR.

	.EXIT			/ RETURN TO BATCH IF HE WANTS TO.

RSX	.SIXBT "RSX"

IMG	.SIXBT "IMG"
MESS=.-2
	.ASCII "NO ENTRY FOR 'RSXIMG' IN SYSBLK -- CALL MARLBORO"<07><7><7><15>

BUFF	.BLOCK 400

	.END
