;	MCRSLP.CMD
;
.ENABLE QUIET
.ENABLE SUBSTITUTION
.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
;
; 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 will be applied to distribution sources
;
;       1.  [012,010]BYE.MAC;1
;       2.  [012,010]INSFL.MAC;1
;       3.  [012,010]INSHD.MAC;1
;       4.  [012,010]INSPS.MAC;1
;       5.  [012,010]MCRDEF.MAC;1
;       6.  [012,010]MCRDIS.MAC;1
;       7.  [012,010]SPSOV.MAC;1
;       8.  [012,010]ST1OV.MAC;1
;       9.  [012,010]ST2OV.MAC;1
;      10.  [015,010]ACNT.MAC;1
;      11.  [015,010]HELLO.MAC;1
;      12.  [015,010]HELROT.MAC;1
;      13.  [015,010]HLPSUB.MAC;1
;      14.  [015,010]HLP.MAC;1
;      15.  [200,200]RSXMC.MAC   The RSXMC.MAC used for the target SYSGEN
;
.; 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
;
; 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
/
.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]"
SET /UIC ='FILUIC'
.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 privleged, EXITING
.IF <EXSTAT> NE 1 /

.ENABLE QUIET
.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.
.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=MCR.OLB
.IF <FILERR> NE 1 PIP MCR.OLB;2/RE=MCR.OLB
.IF <FILERR> NE 1 .DISABLE QUIET
.IF <FILERR> NE 1 ;MCRSLP -- Your origional MCR.OLB backed is up to MCR.VLB
.DISABLE QUIET
MAC ACTFIL.OBJ;1='$EXC':[12,10]ACTFIL.KMS
MAC MCRDEF.OBJ;1=LB:[1,1]EXEMC/ML,[200,200]RSXMC/PA:1,'$EXC':[12,10]MCRDEF
LBR MCR/RP=ACTFIL.OBJ;1,MCRDEF.OBJ;1
PIP ACTFIL.OBJ;1/DE,MCRDEF.OBJ;1
.ASMMLT:
.;
.; Now try and place required modules in MLTUSR.OLB
.TESTFILE ACNT.MAC;2
.IF <FILERR> NE 1 .GOTO NOACNT
MAC ACNT.OBJ;1=LB:[1,1]EXEMC/ML,[200,200]RSXMC,'$EXC':[15,10]ACNT.MAC;2
.NOACNT:
.TESTFILE HELROT.MAC;2
.IF <FILERR> NE 1 .GOTO NOHLRT
MAC HELROT.OBJ;1=LB:[1,1]EXEMC/ML,[200,200]RSXMC,'$EXC':[15,10]HELROT.MAC;2
.NOHLRT:
.TESTFILE HLP.MAC;2
.IF <FILERR> NE 1 .GOTO NOHLP
MAC HLP.OBJ;1=LB:[1,1]EXEMC/ML,[200,200]RSXMC,'$EXC':[15,10]HLP.MAC;2
.NOHLP:
.TESTFILE HLPSUB.MAC;2
.IF <FILERR> NE 1 .GOTO NOHSUB
MAC HLPSUB.OBJ;1=LB:[1,1]EXEMC/ML,[200,200]RSXMC,'$EXC':[15,10]HLPSUB.MAC;2
.NOHSUB:
.TESTFILE MLTUSR.VLB;1
.IF <FILERR> NE 1 PIP MLTUSR.VLB=MLTUSR.OLB;1
.IF <FILERR> NE 1 PIP MLTUSR.OLB;2/RE=MLTUSR.OLB;1
.IF <FILERR> NE 1 .DISABLE QUIET
.IF <FILERR> NE 1 ;MCRSLP -- MLTUSR.OLB backed up to MLTUSR.VLB
.ENABLE QUIET
LBR MLTUSR.OLB/RP=ACNT.OBJ;1,HELROT.OBJ;1,HLP.OBJ;1,HLPSUB.OBJ;1
PIP ACNT.OBJ;1/DE,HELROT.OBJ;1,HLP.OBJ;1,HLPSUB.OBJ;1
.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.OBJ;1=LB:[1,1]EXEMC/ML,[200,200]RSXMC/PA:1,'$EXC':[12,10]INSFL
MAC INSPS.OBJ;1=LB:[1,1]EXEMC/ML,[200,200]RSXMC/PA:1,'$EXC':[12,10]INSPS
.TESTFILE INS.VLB
.IF <FILERR> NE 1 PIP INS.VLB=INS.OLB;1
.IF <FILERR> NE 1 PIP INS.OLB;2/RE=INS.OLB;1
.IF <FILERR> NE 1 .DISABLE QUIET
.IF <FILERR> NE 1 ;MCRSLP -- INS.OLB backed up to INS.VLB
.ENABLE QUIET
LBR INS/RP=INSFL.OBJ;1,INSPS.OBJ;1
PIP INSFL.OBJ;1/DE,INSPS.OBJ;1
.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 
.RENAME:
.SETT SKIPIT				!
.TESTFILE 'TSTUIC''FILE'.'OLDEXT';1
.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 doesn't, maybe already renamed
.TESTFILE 'TSTUIC''FILE'.'NEWEXT';1
.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';1 is not on this device/uic.
; >>>>WARNING, This patch failed!
;
.ENABLE QUIET
.RETURN
.RENAM1:
PIP 'FILE'.'NEWEXT'/RE='FILE'.'OLDEXT';1	! 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
