	.TITLE *** DOS TO RSX BOOTSTRAP ***
/
/ 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.
/
	.EJECT
/	EDIT # 22	JUNE 3 75	M. HEBENSTREIT
/	EDIT # 23	DEC 1 75	SCR  TURN OFF SCOPE FOR VT ON
/	EDIT #24	DEC 8 75	SCR	TAKE OUT CAF
/
/
/	BOOT STRAP PROGRAM TO
/	BOOT RSX FROM A DOS SYSTEM
/
/
/ DEFINING %RP02 PRODUCES A VERSION FOR THE RP02 SYSTEM
/ DEFINING %RF15 PRODUCES A VERSION FOR THE RF15 SYSTEM
/ DEFINING %RK05 PRODUCES A VERSION FOR THE RK05 SYSTEM
	.IFUND %RP02
	.IFUND %RF15
	.IFUND %RK05
	.END -- NO ASSEMBLY PARAMETERS SPECIFIED
	.ENDC
	.ENDC
	.ENDC
/
/
	.DEFIN FIXIT ABC
	LAC	ABC
	XOR	(10000
	DAC	ABC
	.ENDM
DPCA=706344	/LOAD CURRENT ADDRESS
DPCS=706324	/CLEAR STATUS
DPLA=706304	/LOAD CYLINDER,HEAD,SECTOR
DPLF=706464	/EXECUTE
DPRSB=706332	/READ STATUS REG B
DPSE=706361	/SKIP ON ERROR
DPSJ=706341	/SKIP ON DONE
DPWC=706364	/LOAD WORD COUNT
CLOF=700004
.INH=705522
.ENB=705521
IDX=ISZ
SIOA=706001
LIOR=706006
DSSF=707001
DLAL=707024
DLAH=707064
DSCF=707041
DSFX=707042
DSCN=707044
DSCD=707242
DSRS=707262
ION=700042
IOF=700002
X10=10
	.IODEV -2
WARM	LAC	(3
	DAC	NUMWDS	/SET TO READ 3 WORDS OF MFD
	.IFDEF %RK05
	LAC*	(102
	DAC	TCB
	AAC	2
	DAC	EVA
	.ENDC
	LAC	(BUFF
	DAC	BUFADR
	.IFDEF %RP02
	LAC	(47040	/MFD BLOCK
	.ENDC
	.IFUND %RP02
	LAC	(1777
	.ENDC
	DAC	BLOCK
	JMS	GETIN	/INPUT MDF
	LAC	BUFF+2	/POINTS TO SYSBLK
	DAC	BLOCK
	IAC		/-1 MEANS NO SYSBLK
	SNA
	JMP	NOSAV
	LAC	(1000
	DAC	NUMWDS	/SET TO READ SYSBLK
	JMS	GETIN	/READ SYSBLK
	LAC	(BUFF
	IAC
	DAC	XRR
	TAD	BUFF	/1ST WORD OF SYSBLK CONTAINS ITS LENGTH+1
	AAC	-1
	DAC	LRR
NEXTIN	LAC*	XRR	/CHECK FIRST WORD FOR MATCH
	IDX	XRR
	SAD	RSXSAV
	SKP
	JMP	.+4	/NO MATCH
	LAC*	XRR	/TEST 2ND WORD
	SAD	RSXSAV+1
	JMP	GOTBLK	/MATCH
	LAC	XRR
	AAC	6
	DAC	XRR
	TCA
	TAD	LRR
	SMA
	JMP	NEXTIN	/TRY NEXT ENTRY
	JMP	NOSAV	/END OF SYSBLK REACHED WITHOUT A MATCH
/
/ THIS INPUT SUBROUTINE NEEDS:
/ NUMWDS...NUMBER OF WORDS TO TRANSF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K
	AND	(600000		/SET BIT IN TCB
	SZA
	LAC	(4
	DAC*	X10
	DAC	TCBA14
	LAC	BUFADR
	DAC*	X10
	LAC	NUMWDS
	TCA
	DAC*	X10
	DAC	TCBA16
	LAC	FUNCT
	DAC*	X10
	DZM*	X10
	DZM*	X10
	DZM*	X10
	CLA
	SAD	TEMP
	JMP	S
	LAC	TCB
	SIOA
	JMP	.-1
	LIOR
	LAC*	EVA
	SNA!RTL
	JMP	.-2
	SPA
	JMP	TOP
	JMP*	GETIN
	.ENDC
PAKAD	0
NUMWDS	0
BUFADR	0
TEMP	0
	.IFDEF %RP02
FUNCT	11000	/READ
	.ENDC
	.IFDEF %RF15
FUNCT	2
	.ENDC
	.IFDEF %RK05
FUNCT	4
	.ENDC
HEDAD	0
CYLAD	0
BLOCK	0
SECTOR	0
XRR	0
LRR	0
RSXSAV	.SIXBT 'RSXIMG'	/NAME OF SAVE AREA
BUFF	.BLOCK 1000
EVA	0
TCB	0
/
GOTBLK	IDX	XRR	/WORD 2 OF ENTRY POINTS TO SAVE AREA
	LAC*	XRR
	DAC	BLOCK
	LAC	(400	/READ 400 WORDS OF IT
	DAC	NUMWDS
	JMS	GETIN	/READ SAVE AREA
	LAC*	(147		/GET THE MONTH,DAY, AND YEAR FROM DOS
	LMQ
	CLA
	LLS	6		/PICK UP THE MONTH
	DAC	BUFF+136	/AND SAVE IN THE RSX IMAGE
	CLA
	LLS	6		/PICK UP THE DAY
	DAC	BUFF+137	/AND SAVE IN THE RSX IMAGE
	CLA
	LLS	6		/PICK UP THE YEAR
	AAC	106
	DAC	BUFF+140	/AND SAVE IN THE RSX IMAGE
	LAC*	(150		/GET THE HOUR,MINUTE, AND SECOND FROM DOS
	LMQ
	CLA
	LLS	6		/GET THE HOUR
	DAC	BUFF+135	/AND SAVE IN THE RSX IMAGE
	CLA
	LLS	6		/GET THE MINUTE
	DAC	BUFF+134	/AND SAVE IN THE RSX IMAGE
	CLA
	LLS	6		/GET THE SECOND
	DAC	BUFF+133	/AND SAVE IN THE RSX IMAGE
	LAC	BUFF+135	/NOW CALCULATE SSM(SECOND SINCE MIDNITE)
	CLL
	MUL
	.DEC
	60
	.OCT
	LACQ
	TAD	BUFF+134
	MUL
	.DEC
	60
	.OCT
	LACQ
	TAD	BUFF+133
	DAC	BUFF+130	/AND SAVE SSM IN THE RSX IMAGE
	.IFDEF %RP02
	LAC	(21000		/SET THE FUNCTION TO PUT THE BLOCK
	.ENDC
	.IFDEF %RK05
	LAC	(2
	.ENDC
	.IFDEF %RF15
	LAC	(4
	.ENDC
	DAC	FUNCT
	JMS	GETIN		/WRITE OUT THE MODIFIED BLOCK
	.IFDEF %RP02
	LAC	(11000		/SET THE FUNCTION TO READ
	.ENDC
	.IFDEF %RK05
	LAC	(4
	.ENDC
	.IFDEF %RF15
	LAC	(2
	.ENDC
	DAC	FUNCT
/
/ NOW THIS PROGRAM IS READY TO BOOTSTRAP TO RSX FROM DOS
/ THE DATE AND TIME HAS BEEN SUCCESSFULLY PASSED FROM DOS
/ TO RSX SO THAT REAL TIME OPERATIONS IN RSX SHOULD PROCEED
/ AS INTENDED.
/ 
/
	LAC	BUFF+106	/CONTAINS CORE SIZE
	AAC	-30	/LESS 30 SINCE READ STARTS AT LOC 30
	DAC	NUMWDS	/NOW READ THE WHOLE THING
	LAC	(30
	DAC	BUFADR	/STARTING AT LOC. 30
	CLA	/CLEAR AC SO BOOTSTRAP GOES
	JMS	GETIN	/NEVER RETURNS
NOSAV	.INIT -2,0,NOSAV
	.WRITE -2,2,NOAR,100	/WRITE ERROR
	.CLOSE -2
	.EXIT	/THEN LEAVE
NOAR	NOARE-NOAR/2*1000+2
	0
	.ASCII 'NO SAVE AREA ON SYSTEM DISK'<15>
NOARE=.
CLOF=700004
.INH=705522
.ENB=705521
VTOFF=703044		/(23)TURN OFF SCOPE IOT
/
S	.INH		/(23)MAKE SURE SCOPE OFF
	VTOFF		/(23)
	CLOF		/(23)
	FIXIT BANK
	FIXIT BANK+2
	FIXIT BANK+3
	FIXIT BANK+5
	FIXIT BANK+6
	FIXIT BANK+7
/			/(24)TAKE OUT CAF-INH PAIR
	DBA		/DISABLE BANK ADDRESSING
/			/(24)TAKE OUT .DBREL
	CLX		/CLEAR THE XR FOR THE COUNT
BANK	LAC	SIZE	/IICK
	PAL		/STORE THE SIZE OF THE BOOT IN THE LR
SL	LAC*	RSXBT,X	/MOVE THE BOOT
	DAC*	L0,X
	AXS	1	/FINISHED?
	JMP	SL	/LOOP
	LAC	FUNCT	/LOAD READ FUNCTION INTO AC
	JMP*	L0	/AND BEGIN BOOT
/
	.IFDEF %RP02
SIZE	11		/SIZE OF BOOT STRAP
	.ENDC
	.IFDEF %RF15
SIZE	13
	.ENDC
	.IFDEF %RK05
SIZE	26
	.ENDC
RSXBT	BTCODE
L0	0
	.IFDEF %RP02
BTCODE	706464	/DPLF
	706361	/DPSE
	600005	/JMP .+3
	740040	/HLT
	600003	/JMP .-1
	706341	/DPSJ
	600001	/LOOP
	620101	/JMP* 101
	740040
	.ENDC
	.IFDEF %RF15
BTCODE	IOF
	.INH
	DSCF!DSFX!DSCN
	DSSF
	600003
	DSRS
	SPA
	HLT
	.ENB
	ION
	620101
	.ENDC
	.IFDEF %RK05
BTCODE	200025
	SIOA
	600001
	LIOR
	200014
	SNA!RTL
	600004
	SPA
	HLT
	620101
TCBA	23402
	602
	0
TCBA13	0
TCBA14	0
	30
TCBA16	0
	4
	0
	0
	0
	12
	.ENDC
	.END
