	.TITLE DOS -- MCR TASK TO BOOT IN DOS15.
/
/ 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 #7  S. ROOT  6/26/73

/ 
/  INCLUDE BOOT STRAPS FOR RF,RP,RK DISKS

/
/EDIT #9	SCR	1/24/74		RK #013,RP #004,RF #012

/

/EDIT #10	SCR	1/28/74		CLEANUP
/EDIT #11	SCR	10/18/74	UPDATE TO RKBOOT 015
/EDIT #12	SCR	11/12/74	ALLOW UC15 OPTIONS, CHANGE VT
/ EDIT #13	MJH	6/23/75		RKBOOT 017
/ EDIT #14	SCR	11/7/75		RK #020,RP #009,RF #017
/ EDIT #15	PDH	18 JAN 78	ALLOW ORDERLY SHUT DOWN OF
/					TASK TIMING
/
/ EDIT #16	PDH	19 JAN 78	WE FORGOT TO 'PAX' IN EDIT 15
/
/THIS TASK TRANSFERS PROPER BOOTSTRAP TO HIGHEST BANK THAT

/  DOS CAN SEE (UP TO 32K) AND TRANSFERS CONTROL TO THE BOOTSTRAP.

/THIS MUST BE INSTALLED AS A EXC. MODE MCR TASK.

/
/	FOR A DOS SYSTEM CONTAINING AN RK DISK THAT IS NOT A
/  SYSTEM DISK, DEFINE UC15=0 TO OBTAIN AN ALTERNATE BOOTSTRAP.
/
/ TO BOOTSTRAP DO OFF A PARTICULAR DISK REGARDLESS OF THE RSX
/ SYSTEM DISK TYPE:
/	DEFINE RK=0 TO BOOT DOS OFF THE RK UNCONDITIONALLY
/	DEFINE RP=0 TO BOOT DOS OFF THE RP
/	DEFINE RF=0 TO BOOT DOS OFF THE RF

/
	.DBREL

/
/  EQUATES FOR CAL PARAMTER BLOCKS IN EXECUTIVE

RFACTB=210

RPACT0=364

RKACT0=414

TT=163	/TIME AND DATE LOC.'S , RSX
SYSDSK=301
TIMFLG=312		/ TASK TIMING FLAG INSPECTED BY 'EXIT'	/(015)
/

CAF=703302	/CLEAR ALL FLAGS

CLOF=700004	/CLOCK OFF.
.INH=705522	/INHIB. INTERRUPTS.
.ENB=705521	/ENABLE INTERRUPTS.
/
	.EJECT
S	DBA		/ENTER PAGE MODE (PROBABLY IRRELEVANT)
	LAC*	(TIMFLG						/(015)
	SNA							/(015)
	JMP	S1		/ TASK TIMING NOT ACTIVE	/(015)
	LAC	(S						/(015)
	AND	(070000		/ GENERATE XR ADJUSTMENT FACTOR	/(015)
	TCA							/(015)
	TAD*	(TIMFLG		/ GENERATE XR ADJUSTED ADDRESS	/(015)
	DAC	TBLADR		/ OF TASK TIMING CONTROL TABLE	/(015)
	PAX							/(016)
	DZM*	(TIMFLG		/ DISABLE TASK TIMING		/(015)
	CLA!IAC							/(015)
	DAC	6,X		/ SET 'EXITFL' IN 'TSKTM2',	/(015)
	DAC	0,X		/ THEN SET TASK TIMING EV	/(015)
	CAL	MRK20S		/ THIS GIVES THE SYSTEM UP TO	/(015)
				/ 20 SECONDS TO SHUT DOWN.	/(015)
WT15T	LAC	EV20S		/ IF WE TIME OUT, WE ASSUME	/(015)
	SZA			/ TROUBLE, AND GO TO 'DOS'	/(015)
	JMP	S1		/ WITHOUT SHUTTING DOWN.	/(015)
/
	CAL	MRK15T		/ WAIT FOR 15 TICKS (0.25 SEC)	/(015)
	CAL	WFEV						/(015)
	LAC	TBLADR		/ RESTORE XR WITH TABLE ADDRESS	/(015)
	PAX							/(015)
	LAC	6,X		/ HAS TASK EXITTED YET?		/(015)
	SZA							/(015)
	JMP	WT15T		/ NO. WAIT SOME MORE		/(015)
/
	CAL	MRK15T		/ WAIT A FINAL QUARTER SECOND	/(015)
	CAL	WFEV		/ JUST FOR GOOD MEASURE		/(015)
/
	.EJECT
S1	LAC*	(RFACTB						/(015)

        SNA

        JMP     .+6

	CAL	REDEAL	/DEALLOCATE BLOCKS IN FILE HANDLER

	CAL	WFEV	/CHECK EVENT VARIABLE

	LAC	EV	/IS IT OK

	SPA		/SKIP IF YEW

	JMP	DELERR	/IF ERROR, REMAIN IN RSX, TYPE A MESSAGE

	DZM*	(RFACTB

	LAC	(24	/DEALLOCATE RK AND RP FILES HANDLER'S BLKS

	LMQ

	LAC	(RKACT0

	JMS	DEAL

	LAC	(3

	LMQ

	LAC	(RPACT0

	JMS	DEAL

/

/  FIGURE OUT WHICH IS SYSTEM DISK TO DECIDE WHICH BOOT TO LOAD.

/  THIS ASSUMES! THAT DOS AND RSX HAVE !!SAME!! SYSTEM DISK.

/
	LAC*	(SYSDSK	/GET CODE FOR SYSTEM DISK

	SPA		/HAS TO BE POSITIVE
	JMP	SYSBAD	/PRINT MESSAGE, STAY IN RSX
	.IFUND	RF
	.IFUND	RP
	.IFUND	RK
	SAD	(2	/IS IT RF

	LAW	-1	/XR CODE FOR RF, TO BE 0

	SAD	(3	/IS IT RP

	LAW	-2	/XR CODE FOR RP, TO BE 1

	SAD	(24	/IS IT RK
	LAW	-3	/XR CODE FOR RK. TO BE 2
	.ENDC
	.ENDC
	.ENDC
	.IFDEF	RK
	LAW	-3
	.ENDC
	.IFDEF	RF
	LAW	-1
	.ENDC
	.IFDEF	RP
	LAW	-2
	.ENDC
	SMA!CMA		/SKIP IF OK, SET UP AC FOR XR

	JMP	SYSBAD	/MISSED, BAD DISK MESSAGE IN RSX

	PAX		/XR NOW HAS 0=RF,1=RP,2=RK

	LAC	ADDR,X	/GET POINTER TO START OF CORRECT IMAGE IN OUR CORE

	DAC	DOSBT	/AND SAVE FOR LATER BLOCK TRASNFER

/

/  FIGURE OUT WHICH BANK TO PUT THE BOOT IN

/

	LAC*	(136	/RSX SIZE  (77777=32K)

	TAD	(700000	/CHECK IF >32K

	SMA		/SKIP IF NOT

	CLA!CMA		/YES, SET BOTH BANK BITS

	AND	(60000	/KEEP PROPER BANK BITS

	XOR	LB7637	/BUILD WITH BANK 0 BOOT ADDR

	DAC	LB7637	/CORRECT STARTING POINT FOR BOOT LOAD

	AAC	4	/ADDR FOR CONTROL TO PASS TO BOOT

	DAC	LB7643

/

/*************************************************************

/

/  WE NOW LEAVE RSX C(CODE THRU NEXT ***'S)

/

	.INH		/REFUSE TO BE INTERRUPTED

	CLOF		/TURN OFF CLOCK SINCE WE GATHERING TIME ETC.

	703444		/TURN OFF SECOND SCOPE SINCE DOS DOESN'T

/

/  NOW GATHER UP TIME AND DATE TO PASS TO DOS

/

	CLL

	LAC	(TT-1	/FOR AUTO INCR TO GET SIX TIME AND DATE LOC.'S

	DAC*	(10	/USE 10 I GUESS

	LAC*	10	/SECONDS

	AND	(77	/JUST IN CASE

	LRS	6	/PUSH OFF ONTO MQ

	LAC*	10	/MINUTES

	AND	(77

	LRS	6

	LAC*	10	/HOURS

	AND	(77

	LRS	6

	LACQ		/THIS IS NOW HHMMSS IN DOS FORMAT

	DAC	TX64	/PLACE SO IT WILL END UP IN PATCH

/

	LAC*	10	/MONTH

	AND	(77

	LMQ		/THESE SHIFT OTHER DIRECTION

	LLS	6

	LAC*	10	/DAY

	AND	(77

	642000		/OR AC,MQ  RESULT TO MQ

	LLS	6

	LAC*	10	/YEAR - 1900

	AAC	-106	/MAKE YEAR - 1970

	SPA		/SKIP IF STILL POSITIVE

	CLA		/MAKE ZERO (USER MAY NOT HAVE SET DATE)

	AND	(77

	640002		/OR AC,MQ  RESULT TO AC

	DAC	TX63	/RESULT TO PATCH IT IS IN MODAYR DOS FORMAT

/			/WITH YEAR MOD 1970

/

/

/  MOVE BOOTSTRAP AND DATE-TRANSFER-PATCH INTO THEIR PLACES

/

	LAC	ADDR,X	/STARTING ADDR OF BOOT IMAGE

	DAC	DOSBT	/TO POINTER FOR BLOCK TRANSFER

	LAC	SIZE	/AMOUNT TO TRANSER

	PAL		/AS LOOP CONTROL

	CLX		/

SL	LAC*	DOSBT,X	/BLOCK TRANSF. RPBOOT.

	DAC*	LB7637,X

	AXS	1	/BUMP XR AND SKIP IF = TO LMR.

	JMP	SL	/LOOP.

	CLX		/NOW MOVE PATCH TO 47-64

	LAC	XSIZE

	PAL		/SAME KIND OF LOOP

XSL	LAC*	XDOS,X

	DAC*	LB47,X

	AXS	1

	JMP	XSL

/ 

/  NOW TRANSFER CONTROL TO BOOTSTRAP

/

/  NOTE FIRST INSTRUCTION EXECUTED IS EBA, FOLLOWED CLOSELY BY CAF,IOF

/

	JMP*	LB7643	/BYE!

/

/*************************************************************

/

/  CAL'S ETC. FOR USE WHILE STILL IN RSX.

/

/

/

/	SUBROUTINE DEAL -- DEALLOCATE THE BLOCKS FOR A MULTI-UNIT

/	FILES HANDLER. AC HAS STARTING CONTROL TABLE AND MQ HAS

/	DEVICE CODE. ALL REGISTERS ARE ALTERED. RETURN IS TO JMS+1

/	IF NO ERRORS OCCUR. IF AN ERROR IS FOUND, JMP TO DELERR.

/ 

DEAL	0

	DAC	DEALT1	/SAVE THE ADDR. OF CTA TEMPORARILY

	LACQ

	DAC	DEVICE	/STORE THE DEVICE CODE

	LAW	-10

	DAC	DEALT2	/STORE COUNTER FOR MULTI-CTA'S

DEAL2	LAC	DEALT1	/SET CTA ADDR INTO CPB

	DAC	REDEAL+3

	LAC*	DEALT1	/ARE ANY BLOCKS ALLOC. FOR THIS UNIT?

	SNA

	JMP	DEAL1	/NO -- GO TO NEXT UNIT

	CAL	REDEAL	/YES -- DEALLOCATE THEM

	CAL	WFEV

	LAC	EV

	SPA

	JMP	DELERR

	DZM*	DEALT1	/ZERO WORDS ALLOC. TO THAT HANDLER

DEAL1	LAC	DEALT1	/INC THE ADDRESS OF CTA BY 3

	AAC	3

	DAC	DEALT1

	ISZ	DEALT2	/LAST UNIT PROCESSED?

	JMP	DEAL2	/NO -- DO NEXT UNIT

	JMP*	DEAL	/YES -- RETURN AT JMS+1

DEALT1	0

DEALT2	0

WFEV	20

	EV

REQMCR	1

	0

	.SIXBT "..."

	.SIXBT "MCR"

	0

EV	0		/EVENT VARIABLE ALL OP'S

REDEAL	11600		/DEALLOCATION

	EV

	1		/ASSUME UNIT 1, MAYBE LATER A VARIABLE

	RFACTB
DEVICE	2
/
/  CPB'S AND VARIABLE STORAGE FOR SHUTTING DOWN TASK TIMING	/(015)
/
MRK20S	13;	EV20S;	24; 2	/ 'MARK' CPB FOR 20 SECONDS	/(015)
MRK15T	13;	EV;	17; 1	/ 'MARK' CPB FOR 15 TICKS	/(015)
TBLADR;EV20S

/
/     ERROR RETURNS TO RSX

/

SYSBAD	CAL	SYSERR	/SYSTEM THINKS IT HAS STRANGE DISK?!?

	JMP	ERREX	/COMMON ERROR EXIT

/

/

DELERR	CAL	DLERR	/DEALLOCATION ERROR

ERREX	CAL	WFEV	/ERRORS  COME THRU HERE

	CAL	REQMCR

	CAL	(10		/EXIT

DSKERR	CAL	DKERR	/WRITE BIT MAP TO DISK ERROR

	JMP	ERREX

/

DLERR	2700		/WRITE MESSAGE TO CTY

	EV

	3		/LUN

	2		/IOPS ASCII

	DLB

DLB	DLBE-DLB/2*1000+2

	0

	.ASCII 'DEALLOCATION ERROR'<15>

DLBE=.

/

SYSERR	2700

	EV

	3

	2

	SYSB

SYSB	SYSBE-SYSB/2*1000+2

	0

	.ASCII 'ILLEGAL SYSTEM DEVICE'<15>

SYSBE=.

/

/  OTHER THINGS

/

DKERR	2700

	EV

	3

	2

	DKB

DKB	DKBE-DKB/2*1000+2

	0

	.ASCII 'DISK ERROR'<15>

DKBE=.

SIZE	140		/AMOUNT TO TRANSFER FOR BOOTSTRAPS

ADDR	TF637		/ADDR (HERE) OF RFBOOT IMAGE

	TG637		/SAME FOR RPBOOT

	TK637		/SAME FOR RKBOOT

DOSBT	0		/BOOT BLOCK ADDRESS.

LB7637	17637		/IST LOC. OF DOS15 BOOT. BANK 0.

LB7643	0		/START ADDRESS OF BOOT. EXECUTES EBA!

XSIZE	16		/SIZE OF PATCH

XDOS	TX47		/FIRST ASSEMBLED PATCH LOCATION
LB47	47		/LOADING ADDR FOR PATCH
/
/	RPBOOT
/
TG637	000000
 000000
 000000
 000105
 707764
 217642
 057777
 707764
 217771
 057640

 760400

 057641

 157637

 157644

 617663

 020000

 700000

 002000

 000040
 001000
 217656
 745020

 217656

 057645

 117756

 157643

 217637

 057642

 777470

 357642

 741100
 617706
 057642

 217643

 357660

 057643

 617673

 740040

 617646
 777766

 357642

 745102

 617717

 057642

 217643

 357661

 057643
 617706
 217643
 357642

 706304

 217641

 706364

 750010

 357640

 706344

 217644

 517657

 057642

 357657
 706464
 217645

 257642
 706464
 706332

 740020

 741400
 617704
 217662
 706444
 706361
 741000
 617704
 706341

 617745

 117756
/
/
/  LINKAGE TO TIME  DATE PATCH
/
 137776		/JMS* (50  TO BE REPLACED WITH 237777 BY PATCH
 057756
 137756
 000000
 707764
 703044
 776000
 357661
 740200
 617762
 703302
 700012
 707702
 637756
 000077
 000000
 000000
 000000
 000000
 000050
/
/  	THE RKBOOT CODE
/
TK637	000000
 000000
 000000
 000105

 707764

 217642

 057777

 707764

 217701

 057640

 760400

 057641
 157637
 157644
 217702

 117750

 617663

 700000

 000022
 000023
 117671
 745002

 117671

 217644

 517660

 617706

 000000

 703044

 777740

 744230

 617674

 703302

 700002

 637671

 000077

 000200
 000602
 740040
 617646

 742030

 742010

 723002

 077746

 217641

 077745

 742010

 740002

 217640

 723001

 077744

 517660

 740010

 742010

 077743

 217637

 077742

 217703

 117750

 237747

 742010

 741100
 617704
 117671
/
/  AND THE LINKAGE TO TIME DATE PATCH
/
 137776		/JMS* (50 TO BE REPLACED WITH 237777 BY PATCH
 057671
 137671
 000024
 000025
 000026
 000027
 000030
 000031
 000032
 000000
 077662
 177741
 177661
 217661
 157671
 457671
 741000
 617704
 706001
 617756
 706006
 237741
 743210
 617764
 744100
 637750
 617704
 000000
 000000
 000000
 000000
 000050
/
/	RFBOOT
/
TF637	000000
 000000
 000000
 000105

 707764

 217642

 057777

 707764

 117740

 217736

 057640

 760400

 057641

 157637
 157644
 617663

 000005

 400000

 000036

 000037

 217754

 741000

 217657

 057645
 117740
 217637
 742020

 742020

 742020

 742020

 742020

 517700

 617706

 000007

 777400

 740040

 740040

 740040

 617646

 707064

 217641

 077661

 217640
 077662
 217637
 742010

 742010

 742010

 742010
 517701
 707024
 217645

 707047

 707001
 617724

 707272

 707242

 741100
 617704
/
/  AND THE LINKAGE TO THE TIME DATE PATCH
/
 137776		/JMS* (50 TO BE REPLACED BY 237777 BY THE PATCH
 057753
 117740
 137753
 000077
 000001
 000000
 707764
 703044
 777740
 357737
 740200
 617744
 703302
 700002
 707702
 637740
 000000
 000003
	.REPT 21
 000000
 000050
/	PATCH TO OCCUPY 47-64, API WILL BE OFF AT THE TIME

/

/		PATCH WILL GAIN CONTROL AFTER MONITOR HAS BEEN (DOS

/	THAT IS) HAS BEEN LOADED IN CORE, BUT NOT GIVEN CONTROL

/	FIRST JOB, CHANGE BOOTSTRAP SO THAT IT HAS A 237777 RATHER

/	THAN THE PATCH LINKAGE. (DOS BOOTSTRAP IS PART OF SYSTEM!)

/	THE PATCH THEN RAMS IN LOC'S 147,150

/	THE TIME AND DATE COLLECTED FROM RSX SYSTEM. FINALLY,

/	THE PATCH RETURNS CONTROL TO BOOTSTRAP. NOTE DOS SYSTEM

/	STARTS LOAING AT LOC 100. WHEN THE NON-RESIDENT MONITOR

/	IS BROUGHT IN, IT FINDS THERE IS A DATE, SO IT DOESN'T

/	ASK THE USER FOR IT.

/

/

TX47	237777		/PLACE IN BOOTSTRAP

TX50	0		/ENTRY POINT

TX51	777777		/-1 TO CONVERT JMS ADDRESS BACK TO JMS

TX52	340050		/TAD 50 TO MAKE CORRECT ADDRESS

TX53	040050		/HOLD IT IN 50

TX54	200047		/GET THE 237777 TO PUT INTO BOOTSTRAP

TX55	060050		/DAC* BACK ON TOP OF THE JMS HERE

TX56	200063		/GET DATE

TX57	040147		/PLACE INTO DOS SYSTEM LOCATION

TX60	200064		/GET TIME

TX61	040150		/INTO SYSTEM

TX62	620050		/RETURN TO BOOTSTRAP TO EXECUTE CAF

TX63	000000		/RSX DATE HELD HERE

TX64	000000		/RSX TIME HELD HERE

	.END	S
