;	MCRSLP.CMD
@KMSKITVER
;
.ENABLE QUIET
.ENABLE SUBSTITUTION
.;
.; Modified April, 1986 by Tony Scandora
.;
.; All references to ;1 and ;2 of files, which depend on specific releases
.; and updates, have been removed.  This file will probably apply .SLP files
.; to any future release/update of RSX-11M.  All .SLP files will have to
.; be individually checked out for each release/update.
.;
.SETT SKIP1
.SETT SKIP2
.SETT SKIP3
.SETT SKIP4
.SETT SKIP5
.SETT SKIP6
.SETT SKIP7
.SETF SKIP8
.SETF SKIP9
.SETF SKIP10
.SETF SKIP11
.SETF SKIP12
.SETF SKIP13
.SETF SKIP14
.SETT ALLDON
	.IFDF $OU .GOTO DEF1
	ASN SY:=OU:
	.GOTO DEF2
.DEF1:  ASN '$OU'=OU:
.DEF2:	.IFDF $IN .GOTO DEF3
	ASN SY:=IN:
	.GOTO DEF4
.DEF3:	ASN '$IN'=IN:
.DEF4:	
.DISABLE QUIET
.DISABLE DISPLAY
;
; This file will attempt to lead you through the HELLO/ACNT modifications
; and MCR SLP patches.   It is assumed that the  user is sitting with 
; his/her KMSKIT on SY:.  
;
; These SLP files require or use the following distribution sources
;
;       1.  [012,010]BYE.MAC
;       2.  [012,010]INSFL.MAC
;       3.  [012,010]INSHD.MAC
;       4.  [012,010]INSPS.MAC
;       5.  [012,010]MCRDEF.MAC
;       6.  [012,010]MCRDIS.MAC
;       7.  [012,010]SPSOV.MAC
;       8.  [012,010]ST1OV.MAC
;       9.  [012,010]ST2OV.MAC
;      10.  [015,010]ACNT.MAC
;      11.  [015,010]HELLO.MAC
;      12.  [015,010]HELROT.MAC
;      13.  [015,010]HLPSUB.MAC
;      14.  [015,010]HLP.MAC
;      15.  [200,200]RSXMC.MAC   The RSXMC.MAC used for the target SYSGEN
;
.ENABLE DISPLAY
.; Since the assembly will fail unless RSXMC.MAC exists, we are going to
.; see if it exists.  We specifically do not use the one on [11,10] since
.; it can be left incomplete by a Prep-Gen.  It is assumed that the user
.; started out with KMSGEN which tries to transfer RSXMC.MAC from the user's
.; current SYSUIC to [200,200].
.TESTFILE LB:[200,200]RSXMC.MAC
.IF <FILERR> EQ 1  .GOTO OK
.DISABLE QUIET
.DISABLE DISPLAY
;
; A valid RSXMC.MAC is absolutely required to exist on LB:[200,200] prior
; to this command file being executed.  Please copy the RSXMC.MAC which
; pertains to the current target system being generated to LB:[200,200]
; and start up KMSGEN again when ready.  Exiting.....
.enable quiet
.ENABLE DISPLAY
/
.OK:
.SETS OURUIC <UIC>
.ASKUIC:
.ASKS FILUIC On what UIC are SLP patch files (<cr> defaults to [344,40])
.IF FILUIC EQ "" .SETS FILUIC "[344,40]"
.ENABLE QUIET
SET /UIC ='FILUIC'
.DISABLE QUIET
.IF <EXSTAT> NE 1 ;You typed in an illegal UIC string try again
.IF <EXSTAT> NE 1 .GOTO ASKUIC
;
.ENABLE QUIET
SET /PRIV=TI:
.DISABLE QUIET
.IF <EXSTAT> NE 1 ; Sorry this uic is not privileged, EXITING
.IF <EXSTAT> NE 1 /
.ENABLE QUIET
.IFNINS LBR INS $LBR
.IFNINS SLP INS $SLP
.SETS DSK <SYDISK>+"'<SYUNIT>'"+":"
.Q2:.ASKS TEMP Which device is the MCR Source Disk( <CR>-EXIT, DDU)
.IF TEMP EQ "" /
.SETS $EXC TEMP[1:3]
ASN '$EXC':=SY:
.IF <EXSTAT> EQ 1 .GOTO Q3
.DISABLE QUIET
;
; You entered an illegal device or device string, Try again
;
.ENABLE QUIET
.GOTO Q2
.Q3:.ASKS TEMP Which device are the [015,010] files on (<CR>-EXIT, DDU)
.IF TEMP EQ "" /
.SETS $LBX TEMP[1:3]
ASN '$LBX':=SY:
.IF <EXSTAT> EQ 1 .GOTO CONT1
.DISABLE QUIET
;
; You entered an illegal device or device string, Try again
;
.ENABLE QUIET
.GOTO Q3
.CONT1:
.SETS UIC <UIC>
SET /UIC=[12,40]
ASN '$EXC':=SY:
PIP SY:/NV='DSK''UIC'BYE.SLP,INSFL,INSHD,INSPS,MCRDEF
PIP SY:/NV='DSK''UIC'MCRDIS.SLP,SPSOV,ST1OV,ST2OV
PIP SY:/NV='DSK''UIC'ICPFIL.SLP,ICPPRE.SLP,ICPROT.SLP,ICPSYT.SLP
SET /UIC=[12,10]
PIP SY:/NV='DSK''UIC'ACTFIL.KMS
SET /UIC=[15,40]
ASN '$LBX':=SY:
PIP SY:/NV='DSK''UIC'ACNT.SLP,HELLO.SLP,HELROT.SLP,HLP.SLP,HLPSUB.SLP
ASN '$EXC':=SY:
SET /UIC=[12,10]

; Test for MCR files to SLP
.SETS OLDEXT "MAC"				! TEST FOR .MAC SOURCES
.SETS NEWEXT "VGN"				! RENAME TO .VGN SOURCE
.SETS TSTUIC "[12,10]

.; 1) BYE.MAC					!
.SETS FILE "BYE"				! SET FILE TO RENAME
.GOSUB RENAME					! RENAME IT
.SET'SKIPIT' SKIP1				! SET SKIP FLAG

.; 2) INSFL.MAC
.SETS FILE "INSFL"				! SET FILE TO RENAME
.GOSUB RENAME					! RENAME IT
.SET'SKIPIT' SKIP2				! SET SKIP FLAG AS APPROPRIATE

.; 3) INSHD.MAC
.SETS FILE "INSHD"				! SET FILE TO RENAME
.GOSUB RENAME					! RENAME IT
.SET'SKIPIT' SKIP3				! SET SKIP FLAG 

.; 4) INSPS.MAC
.SETS FILE "INSPS"				! Set file to rename
.GOSUB RENAME					! Rename it if present
.SET'SKIPIT' SKIP4				! Set skip flag

.; 5) MCRDEF.MAC
.SETS FILE "MCRDEF"				! Set file to rename
.GOSUB RENAME					! Rename it if present
.SET'SKIPIT' SKIP5				! Set skip flag as appropriate

.; 6) MCRDIS.MAC
.SETS FILE "MCRDIS"				! Set file to rename
.GOSUB RENAME					! Rename it if present
.SET'SKIPIT' SKIP6				! Set skip flag as appropriate

.; 7) SPSOV.MAC
.SETS FILE "SPSOV"				! Set file to rename
.GOSUB RENAME					! Rename it if present
.SET'SKIPIT' SKIP7				! Set skip flag as appropriate

.; 8) ST1OV.MAC
.SETS FILE "ST1OV"				! Set file to rename
.GOSUB RENAME					! Rename it if present
.SET'SKIPIT' SKIP8				! Set skip flag as appropriate

.; 8) ST2OV.MAC
.SETS FILE "ST2OV"				! Set file to rename
.GOSUB RENAME					! Rename it if present
.SET'SKIPIT' SKIP9				! Set skip flag as appropriate

.IFNINS SLP INS $SLP
SET /UIC=[12,10]
.IFF SKIP1  SLP @[12,40]BYE.SLP
.IFF SKIP2  SLP @[12,40]INSFL.SLP
.IFF SKIP3  SLP @[12,40]INSHD.SLP
.IFF SKIP4  SLP @[12,40]INSPS.SLP
.IFF SKIP5  SLP @[12,40]MCRDEF.SLP
.IFF SKIP6  SLP @[12,40]MCRDIS.SLP
.IFF SKIP7  SLP @[12,40]SPSOV.SLP
.IFF SKIP8  SLP @[12,40]ST1OV.SLP
.IFF SKIP9  SLP @[12,40]ST2OV.SLP
.;
.; check for correct command files for HELLO and ACNT
.;
.SETS TSTUIC "[15,10]
SET /UIC=[15,10]
ASN '$LBX':=SY:
 
.; Do required source files exist
.;
.; 10) HELLO.MAC
.SETS FILE "HELLO"			! SET FILE NAME
.GOSUB RENAME				!
.SET'SKIPIT' SKIP10			! SET FLAG

.; 11) HELROT.MAC
.SETS FILE "HELROT"			! NAME IT
.GOSUB RENAME				! RENAME IT
.SET'SKIPIT' SKIP11			! SET FLAG

.;12) HLP.MAC
.SETS FILE "HLP"			! NAME IT
.GOSUB RENAME				! RENAME IT
.SET'SKIPIT' SKIP12			! SET FLAG

.; 13) HLPSUB.MAC
.SETS FILE "HLPSUB"			! NAME IT
.GOSUB RENAME				! RENAME
.SET'SKIPIT' SKIP13			! SET FLAG 

.; 14) ACNT.MAC
.SETS FILE "ACNT"			! NAME IT
.GOSUB RENAME				! RENAME
.SET'SKIPIT' SKIP14			! SET FLAG 

 

.IFF SKIP10 SLP @[15,40]HELLO.SLP
.IFF SKIP11 SLP @[15,40]HELROT.SLP
.IFF SKIP12 SLP @[15,40]HLP.SLP
.IFF SKIP13 SLP @[15,40]HLPSUB.SLP
.IFF SKIP14 SLP @[15,40]ACNT.SLP

.; Now see if we can place the new ACTFIL and MCRDEF in MCR.OLB
.;
.;
.SETT ACTFIL				! Assume can update this
.SETT MCRDEF
.TESTFILE SY:[1,24]MCR.OLB
.IF <FILERR> NE 1 .SETF ACTFIL
.IFF ACTFIL .DISABLE QUIET
.IFF ACTFIL ; Warning -- SY:[1,24]MCR.OLB could not be found
.IFF ACTFIL ;            You must assemble ACTFIL.KMS and MCRDEF hand 
.IFF ACTFIL ;            and place them in MCR.OLB prior to a SYSGEN.
.ENABLE QUIET
.IFF ACTFIL .GOTO ASMMLT
SET /UIC = [1,24]
.; See if we have done this procedure once
.TESTFILE MCR.VLB
.IF <FILERR> NE 1 PIP MCR.VLB;*/RE=MCR.OLB;*
.IF <FILERR> NE 1 PIP MCR.OLB=MCR.VLB
.IF <FILERR> NE 1 ;MCRSLP -- Your original MCR.OLB is backed up to MCR.VLB
.DISABLE QUIET
MAC ACTFIL='$EXC':[12,10]ACTFIL.KMS
MAC MCRDEF=LB:[1,1]EXEMC/ML,[200,200]RSXMC/PA:1,'$EXC':[12,10]MCRDEF
LBR MCR/RP=ACTFIL,MCRDEF
PIP ACTFIL.OBJ;0/DE,MCRDEF.OBJ;0
.ASMMLT:
.;
.; Now try and place required modules in MLTUSR.OLB
.TESTFILE [15,10]ACNT.MAC
.IF <FILERR> NE 1 .GOTO NOACNT
MAC ACNT=LB:[1,1]EXEMC/ML,[200,200]RSXMC,'$EXC':[15,10]ACNT.MAC
.NOACNT:
.TESTFILE [15,10]HELROT.MAC
.IF <FILERR> NE 1 .GOTO NOHLRT
MAC HELROT=LB:[1,1]EXEMC/ML,[200,200]RSXMC,'$EXC':[15,10]HELROT.MAC
.NOHLRT:
.TESTFILE [15,10]HLP.MAC
.IF <FILERR> NE 1 .GOTO NOHLP
MAC HLP=LB:[1,1]EXEMC/ML,[200,200]RSXMC,'$EXC':[15,10]HLP.MAC
.NOHLP:
.TESTFILE [15,10]HLPSUB.MAC
.IF <FILERR> NE 1 .GOTO NOHSUB
MAC HLPSUB=LB:[1,1]EXEMC/ML,[200,200]RSXMC,'$EXC':[15,10]HLPSUB.MAC
.NOHSUB:
.TESTFILE MLTUSR.VLB
.IF <FILERR> NE 1 PIP MLTUSR.VLB;*/RE=MLTUSR.OLB;*
.IF <FILERR> NE 1 PIP MLTUSR.OLB=MLTUSR.VLB
.IF <FILERR> NE 1 .DISABLE QUIET
.IF <FILERR> NE 1 ;MCRSLP -- MLTUSR.OLB backed up to MLTUSR.VLB
.ENABLE QUIET
LBR MLTUSR/RP=ACNT,HELROT,HLP,HLPSUB
PIP ACNT.OBJ;0/DE,HELROT.OBJ;0,HLP.OBJ;0,HLPSUB.OBJ;0
.DISABLE QUIET
;MCRSLP -- MLTUSR.OLB updated with ACNT, HELROT, HLP, and HLPSUB
.ENABLE QUIET
.;
.;
.; Now assemble the INS modifications for LIBUIC and NETUIC
MAC INSFL=LB:[1,1]EXEMC/ML,[200,200]RSXMC/PA:1,'$EXC':[12,10]INSFL
MAC INSPS=LB:[1,1]EXEMC/ML,[200,200]RSXMC/PA:1,'$EXC':[12,10]INSPS
.TESTFILE INS.VLB
.IF <FILERR> NE 1 PIP INS.VLB;*/RE=INS.OLB;*
.IF <FILERR> NE 1 PIP INS.OLB=INS.VLB
.IF <FILERR> NE 1 .DISABLE QUIET
.IF <FILERR> NE 1 ;MCRSLP -- INS.OLB backed up to INS.VLB
.ENABLE QUIET
LBR INS/RP=INSFL,INSPS
PIP INSFL.OBJ;0/DE,INSPS.OBJ;0
.DISABLE QUIET
;MCRSLP -- INS.OLB updated with INSFL and INSPS
.ENABLE QUIET
.TSTSLP:
.DISABLE QUIET
	    ;MCRSLP -- ACTFIL updated
.IFF SKIP1  ;MCRSLP -- BYE  updated
.IFF SKIP2  ;MCRSLP -- INSFL updated
.IFF SKIP3  ;MCRSLP -- INSHD updated
.IFF SKIP4  ;MCRSLP -- INSPS updated
.IFF SKIP5  ;MCRSLP -- MCRDEF updated
.IFF SKIP6  ;MCRSLP -- MCRDIS updated
.IFF SKIP7  ;MCRSLP -- SPSOV updated
.IFF SKIP8  ;MCRSLP -- ST1OV updated
.IFF SKIP9  ;MCRSLP -- ST2OV updated
.IFF SKIP10 ;MCRSLP -- HELLO updated
.IFF SKIP11 ;MCRSLP -- HELROT updated
.IFF SKIP12 ;MCRSLP -- HLP updated
.IFF SKIP13 ;MCRSLP -- HLPSUB updated
.IFF SKIP14 ;MCRSLP -- ACNT updated
.ENABLE QUIET

.DISABLE QUIET
.IFT SKIP1  .OR .IFT SKIP1  .OR .IFT SKIP3  .OR .IFT SKIP4  .SETF ALLDON
.IFT SKIP5  .OR .IFT SKIP6  .OR .IFT SKIP7  .OR .IFT SKIP8  .SETF ALLDON
.IFT SKIP9  .OR .IFT SKIP10 .OR .IFT SKIP11 .OR .IFT SKIP12 .SETF ALLDON
.IFT SKIP13 .OR .IFT SKIP14 .SETF ALLDON
;
.;
.IFF ALLDON .GOTO BADBAD
.DISABLE QUIET
;
; This ends the MCR SLP modifications.
;
.ENABLE QUIET
SET /UIC ='OURUIC'
ASN 'DSK'=SY:
.EXIT
.BADBAD:.DISABLE QUIET
	;
	;  One or more of your MCR modules has not been updated.
	;  Find out why and fix the problem.
	;
	.ENABLE QUIET
	SET /UIC ='OURUIC'
	ASN 'DSK'=SY:
	.EXIT 4
.; Subroutine to test/rename files prior to SLPing
.; FILE = name of file to be SLPed
.; OLDEXT = old file name extension
.; NEWEXT= new file name extension
.; SKIPIT=<TRUE>  if FILE.NEWEXT exists
.;       =<FALSE> if FILE.NEWEXT does not exist and can't be 
.;				 renamed from FILE.OLDEXT
.RENAME:
.SETT SKIPIT				! Assume already SLPed or file missing
.TESTFILE 'TSTUIC''FILE'.'OLDEXT'
.IF <FILERR> EQ 1 .SETF SKIPIT		! If EQ yes it exists, don't skip SLP
.IFF SKIPIT .GOTO RENAM1		! IFF, it exists, go rename it
.; If it does not, maybe already renamed
.TESTFILE 'TSTUIC''FILE'.'NEWEXT'
.IF <FILERR> EQ 1 .SETF SKIPIT		! If EQ, it has been renamed
.IFF SKIPIT .RETURN			! IFF, has been renamed, skip rename
.; 
.; At this point the file neither exists, nor has it already been renamed
.DISABLE QUIET
;
; 'FILE'.'OLDEXT' is not on this device/uic.
; >>>>WARNING, This patch failed!
;
.ENABLE QUIET
.RETURN
.RENAM1:
PIP 'FILE'.'NEWEXT';*/RE='FILE'.'OLDEXT';*! RENAME THE FILE
.IF <EXSTAT> NE 1 .SETT SKIPIT		! IF RENAME FAILS
.DISABLE QUIET
;
.IFT SKIPIT ; Error renaming 'FILE'.'OLDEXT' to 'FILE'.'NEWEXT'
.IFF SKIPIT ; File 'FILE'.'OLDEXT' renamed to 'FILE'.'NEWEXT'
;
.ENABLE QUIET
.RETURN					! RETURN TO MAINLINE
