FCMRG	MACRO M1110  21-AUG-78 23:22  PAGE 3





      1						.TITLE	FCMRG

      2						.IDENT	/00.4/

      3

      4					;

      5					; COPYRIGHT (C) 1976, 1977

      6					; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

      7					;

      8					; THIS SOFTWARE IS FURNISHED UNDER  A LICENSE FOR USE ONLY  ON  A

      9					; SINGLE COMPUTER SYSTEM AND MAY BE  COPIED ONLY WITH  THE INCLU-

     10					; SION OF  THE  ABOVE  COPYRIGHT NOTICE.  THIS SOFTWARE,  OR  ANY

     11					; OTHER COPIES THEREOF, MAY NOT BE  PROVIDED  OR  OTHERWISE  MADE

     12					; AVAILABLE TO ANY OTHER PERSON EXCEPT  FOR  USE  ON  SUCH SYSTEM

     13					; AND TO  ONE WHO AGREES  TO  THESE LICENSE  TERMS.  TITLE TO AND

     14					; OWNERSHIP OF THE SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.

     15					;

     16					; THE INFORMATION IN THIS SOFTWARE  IS  SUBJECT TO CHANGE WITHOUT

     17					; NOTICE AND SHOULD NOT BE CONSTRUED  AS  A COMMITMENT BY DIGITAL

     18					; EQUIPMENT CORPORATION.

     19					;

     20					; DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS

     21					; SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

     22					;

     23					; VERSION 00

     24					;

     25					; C. A. MONIA 18-OCT-77

     26					;

     27					; MERGE TASK FILE WITH AME EXECUTABLE IMAGE

     28					;

     29					; MACRO LIBRARY CALLS

     30					;

     31

     32						.MCALL	FDOF$L,HDRDF$,LBLDF$,READ$,WAIT$,WRITE$

     33

     34	000000					FDOF$L			; DEFINE FDB OFFSETS LOCALLY

     35	000000					HDRDF$			; DEFINE HEADER OFFSETS

     36	000000					LBLDF$			; DEFINE LABEL BLOCK OFFSETS

     37

     38					;

     39					; LOCAL MACROS

     40					;

     41					; READ A BLOCK FROM INPUT FILE

     42					;

     43

     44						.MACRO	READ	FDB

     45						.IF NB	FDB

     46						.IF DIF <FDB>,<R0>

     47						MOV	FDB,R0

     48						.ENDC

     49						.ENDC

     50						CALL	READ

     51						.ENDM

     52

     53					;

     54					; WRITE A BLOCK TO OUTPUT FILE

     55					;

     56

     57						.MACRO	WRITE

FCMRG	MACRO M1110  21-AUG-78 23:22  PAGE 3-1





     58						CALL	WRITE

     59						.ENDM

     60

     61					;

     62					; LOCAL DATA

     63					;

     64					; DEFAULT VBN OF TASK OF LABEL BLOCK

     65					;

     66

     67	000000				DFVBN:	.BLKW	1		;

     68

     69					;

     70					; OUTPUT FILE HEADER BLOCK BIAS

     71					;

     72

     73	000002				HDBS:	.BLKW	1		;

     74

     75					;+

     76					; **-$FCMRG-MERGE COMPATIBILITY MODE EMULATOR AND TASK IMAGE FILES

     77					;

     78					; THIS ROUTINE IS CALLED TO COMBINE THE TASK IMAGE WITH THE CME EXE-

     79					; CUTABLE IMAGE FILE TO PRODUCE THE OUTPUT FILE.

     80					;

     81					;-

     82

     83	000004				$FCMRG::			;

     84	000004					SAVRG			; SAVE R3 - R5

     85	000010	005067 	177766 			CLR	HDBS		; CLEAR HEADER VBN BIAS

     86	000014	012701 	001000 			MOV	#512.,R1	; GET BLOCK SIZE

     87	000020					CALL	$ALBLK		; ALLOCATE BLOCK

     88	000024	010005 				MOV	R0,R5		; SAVE ADDRESS OF BLOCK

     89	000026	032767 	000000G	000000G		BIT	#OU$FL,$SWTCH	; OUTPUT FILE SPECIFIED?

     90	000034	001402 				BEQ	10$		; IF EQ NO

     91	000036					CALL	$OPNOU		; OPEN OUTPUT FILE

     92	000042				10$:				;

     93	000042					CALL	$OPNIN		; OPEN CME INPUT FILE

     94	000046					CALL	$OPNTK		; OPEN TASK IMAGE FILE

     95	000052					READ	#$INFDB		; READ ONE BLOCK OF INPUT FILE

     96	000062	103002 				BCC	12$		; IF C/C OK

     97	000064	000167 	000452 			JMP	IOERR		; ELSE PREMATURE EOF

     98	000070				12$:				;

     99	000070	010004 				MOV	R0,R4		; COPY FDB ADDRESS

    100	000072	116501 	000000G			MOVB	I$XBCT(R5),R1	; GET HEADER BLOCK COUNT ASSUMING XLINK FORMAT

    101	000076	026527 	000000G	000000G		CMP	I$XMAD(R5),#IX$MAD ; OLD FORMAT?

    102	000104	001023 				BNE	20$		; IF NE NO

    103	000106	110103 				MOVB	R1,R3		; COPY NUMBER OF HEADER BLOCKS

    104	000110	105203 				INCB	R3		; CONVERT TO VBN

    105	000112	010502 				MOV	R5,R2		; COPY ADDRESS OF BLOCK

    106	000114				15$:				;

    107	000114	061202 				ADD	(R2),R2		; POINT TO NEXT ISD ENTRY

    108	000116	005712 				TST	(R2)		; END OF ISD LIST?

    109	000120	001417 				BEQ	30$		; IF EQ YES

    110	000122	021227 	000000G			CMP	(R2),#I$SLPR	; PRIVATE ISD?

    111	000126	001372 				BNE	15$		; IF NE NO

    112	000130	120362 	000000G			CMPB	R3,I$SVBN(R2)	; AT INITIAL VBN?

    113	000134	001367 				BNE	15$		; IF NE NO

    114	000136	152762 	000000C	000000G		BISB	#<IS$CRF!IS$WRT>,I$SFLG(R2) ; SET R/W ACCESS, COPY ON REFERENCE

FCMRG	MACRO M1110  21-AUG-78 23:22  PAGE 3-2





    115	000144	142762 	000000G	000000G		BICB	#IS$DZR,I$SFLG(R2) ; CLEAR DEMAND ZERO PAGE

    116	000152	000402 				BR	30$		;

    117	000154				20$:				;

    118	000154	116501 	000000G			MOVB	I$HBCT(R5),R1	; GET CORRECT BLOCK COUNT

    119	000160				30$:				;

    120	000160	005002 				CLR	R2		; SET FOR MOVB WITH NO SIGN EXTEND

    121	000162	150102 				BISB	R1,R2		; GET NUMBER OF BLOCKS IN VMS IMAGE HEADER

    122	000164	005202 				INC	R2		; CONVERT TO VBN OF FIRST BLOCK PAST HEADER

    123	000166	010267 	177606 			MOV	R2,DFVBN	; SAVE DEFAULT BLOCK NUMBER

    124	000172	012746 	000434'			MOV	#COPY1,-(SP)	; PUSH ADDRESS OF COPY ROUTINE

    125	000176	032767 	000000G	000000G		BIT	#HD$SWT,$SWTCH	; COPY FILE WITH NO HEADER?

    126	000204	001007 				BNE	35$		; IF NE NO

    127	000206	012716 	000424'			MOV	#COPY,(SP)	; SET TO COPY FILE LESS HEADER

    128	000212	010267 	000066G			MOV	R2,$INFDB+F.BKVB+2 ; SET TO FIRST VBN PAST VMS HEADER

    129	000216	005302 				DEC	R2		; BACK OFF TO NUMBER OF HEADER BLOCKS

    130	000220	010267 	177556 			MOV	R2,HDBS		; SAVE HEADER BIAS

    131	000224				35$:				;

    132	000224	005003 				CLR	R3		; SET TO COPY INPUT FILE

    133	000226					CALL	@(SP)+		; COPY FILE

    134	000230					READ	#$TKFDB		; READ FIRST TASK IMAGE LABEL BLOCK

    135	000240	103540 				BCS	IOERR		; IF C/S ERROR

    136	000242	016501 	000020 			MOV	L$BMXZ(R5),R1	; GET SIZE OF TASK IN 64-BYTE BLOCKS

    137	000246	062701 	000007 			ADD	#7,R1		; ROUND TO MULTIPLE OF 512 BYTES

    138	000252	006201 				ASR	R1		; CONVERT TO NUMBER OF BLOCKS

    139	000254	006201 				ASR	R1		; ...

    140	000256	006201 				ASR	R1		; ...

    141	000260	010102 				MOV	R1,R2		; COPY NUMBER OF BLOCKS IN IMAGE

    142	000262	066702 	177512 			ADD	DFVBN,R2	; BIAS BY VBN OF FIRST BLOCK PAST VMS HEADER

    143	000266	032767 	000000G	000000G		BIT	#LB$BLK,$SWTCH	; LABEL BLOCK LOCATION SPECIFIED?

    144	000274	001402 				BEQ	40$		; IF EQ NO

    145	000276	016702 	000000G			MOV	$LBBLK,R2	; GET VBN OF LABEL

    146	000302				40$:				;

    147	000302	166702 	177474 			SUB	HDBS,R2		; SUBTRACT HEADER BIAS OF EXECUTABLE IMAGE

    148	000306	010267 	000066G			MOV	R2,$OUFDB+F.BKVB+2 ; SET VBN TO WRITE LABEL

    149	000312	016502 	000356 			MOV	L$BHRB(R5),R2	; GET RELATIVE BLOCK NUMBER OF HEADER

    150	000316	005202 				INC	R2		; CONVERT RELATIVE BLOCK NUMBER TO VBN

    151	000320	016503 	000360 			MOV	L$BBLK(R5),R3	; GET NUMBER OF BLOCKS IN LABEL

    152	000324	012704 	000000G			MOV	#$TKFDB,R4	; GET ADDRESS OF TASK FILE FDB

    153	000330					CALL	COPY1		; COPY LABEL BLOCKS TO OUTPUT

    154	000334	010103 				MOV	R1,R3		; COPY NUMBER OF BLOCKS IN TASK IMAGE

    155	000336	001421 				BEQ	80$		; IF EQ, EXIT NOW

    156	000340	010264 	000066 			MOV	R2,F.BKVB+2(R4)	; SET VBN OF TASK IMAGE

    157	000344	016702 	177430 			MOV	DFVBN,R2	; SET DEFAULT VBN FOR TASK IMAGE

    158	000350	032767 	000000G	000000G		BIT	#TK$BLK,$SWTCH	; TASK IMAGE LOCATION SPECIFIED?

    159	000356	001402 				BEQ	50$		; IF EQ NO

    160	000360	016702 	000000G			MOV	$TKBLK,R2	; GET LOCATION OF BLOCK

    161	000364				50$:				;

    162	000364	166702 	177412 			SUB	HDBS,R2		; REMOVE HEADER BIAS OF EXECUTABLE IMAGE

    163	000370	010267 	000066G			MOV	R2,$OUFDB+F.BKVB+2 ; SET LOCATION IN OUTPUT FILE

    164	000374					CALL	COPY		; COPY TASK IMAGE

    165	000400	103460 				BCS	IOERR		; IF C/S ERROR

    166	000402				80$:				;

    167	000402					CALL	$FCMCL		; CLOSE ALL FILES

    168	000406	010502 				MOV	R5,R2		; SET ADDRESS OF BLOCK TO RELEASE

    169	000410	012701 	001000 			MOV	#512.,R1	; SET BYTE COUNT

    170	000414	016700 	000000G			MOV	.FSRPT,R0	; GET ADDRESS OF LISTHEAD

    171	000420					CALLR	$RLCB		; RELEASE BLOCK

FCMRG	MACRO M1110  21-AUG-78 23:22  PAGE 3-3





    172

    173					;

    174					; COPY AN INPUT FILE TO THE OUTPUT FILE

    175					;

    176					; INPUTS:

    177					;

    178					;	R3 = NUMBER OF BLOCKS TO COPY

    179					;	R4 = ADDRESS OF INPUT FILE FDB

    180					;	R5 = ADDRESS OF BLOCK BUFFER

    181					;

    182

    183						.ENABL	LSB

    184

    185	000424				COPY:				;

    186	000424					READ	R4		; READ A BLOCK FROM THE INPUT FILE

    187	000432	103404 				BCS	10$		; IF C/S END-OF-FILE

    188	000434				COPY1:				;

    189	000434					WRITE			; WRITE A BLOCK TO THE OUTPUT

    190	000440					SOB	R3,COPY		; LOOP

    191	000444				10$:				;

    192	000444					RETURN			;

    193

    194						.DSABL	LSB

    195

    196

    197					;

    198					; READ A BLOCK FROM TASK OR CME FILES

    199					;

    200					; INPUTS:

    201					;

    202					;	R0 = ADDRESS OF FDB

    203					;

    204					; OUTPUTS:

    205					;

    206					; 	C/C = RECORD READ WITH NO ERRORS

    207					;

    208					;	C/S = END OF FILE ENCOUNTERED

    209					;

    210

    211	000446				READ:				;

    212	000446					READ$	R0,R5		; READ A BLOCK

    213	000456	103423 				BCS	CKEOF		; IF C/S TEST FOR END OF FILE

    214	000460					WAIT$			; WAIT FOR I/O COMPLETION

    215	000464	103420 				BCS	CKEOF		; IF C/S TEST FOR EOF

    216	000466					RETURN			;

    217

    218					;

    219					; CONDITIONALLY WRITE A BLOCK

    220					;

    221					; INPUTS:

    222					;

    223					;	R1 = ADDRESS OF BLOCK TO BE WRITTEN

    224					;

    225					; OUTPUTS:

    226					;

    227					;	NONE

    228					;

FCMRG	MACRO M1110  21-AUG-78 23:22  PAGE 3-4





    229

    230	000470				WRITE:				;

    231	000470	032767 	000000G	000000G		BIT	#OU$FL,$SWTCH	; OUTPUT FILE SPECIFIED?

    232	000476	001412 				BEQ	10$		; IF EQ YES

    233	000500					WRITE$	#$OUFDB,R5	; WRITE BLOCK TO OUTPUT

    234	000514	103412 				BCS	IOERR		; IF C/S I/O ERROR

    235	000516					WAIT$			; WAIT FOR OUTPUT TO COMPLETE

    236	000522	103407 				BCS	IOERR		; IF C/S I/O ERROR

    237	000524				10$:				;

    238	000524					RETURN			;

    239

    240					;

    241					; CHECK FOR END OF FILE

    242					;

    243					; INPUTS:

    244					;

    245					;	R0 = ADDRESS OF FDB

    246					;

    247					; OUTPUTS:

    248					;

    249					;	C/S = END OF FILE ENCOUNTERED

    250					;

    251					; ALL OTHER ERRORS ARE CONSIDERED FATAL.

    252

    253	000526				CKEOF:				;

    254	000526	126027 	000052 	000000G		CMPB	F.ERR(R0),#IE.EOF ; REACHED END OF FILE?

    255	000534	001002 				BNE	IOERR		; IF NO, I/O ERROR

    256	000536	000261 				SEC			; SET CARRY

    257	000540					RETURN			;

    258

    259					;

    260					; I/O ERROR ON FILE

    261					;

    262					; INPUTS:

    263					;

    264					;	R0 = ADDRESS OF FDB

    265					;

    266

    267	000542				IOERR:				;

    268	000542	010002 				MOV	R0,R2		; COPY FDB ADDRESS

    269	000544	062702 	000110 			ADD	#F.FNB+N.FNAM,R2 ; POINT TO FILE NAME

    270	000550					ERROR$	E$R15,S$V2	; FATAL I/O ERROR ON FILE

    271

    272		000001 				.END

FCMRG	MACRO M1110  21-AUG-78 23:22  PAGE 3-5

SYMBOL TABLE



CKEOF   000526R  	F.RACC= 000016   	H.SPRI  000060   	L$BWND  000024   	TS$NET= 001000

COPY    000424R  	F.RATT= 000001   	H.TKVA  000026   	L$BXFR  000350   	TS$NHD= 040000

COPY1   000434R  	F.RCNM= 000034   	H.TKVL  000030   	N.DID = 000024   	TS$NSD= 002000

CR    = 000015   	F.RCTL= 000017   	H.VEXT  000056   	N.DVNM= 000032   	TS$PIC= 100000

DFVBN   000000R  	F.RSIZ= 000002   	H.WND   000044   	N.FID = 000000   	TS$PMD= 010000

E$R15 = ****** GX	F.RTYP= 000000   	IE.EOF= ****** GX	N.FNAM= 000006   	TS$PRV= 000400

FF    = 000014   	F.SEQN= 000100   	IOERR   000542R  	N.FTYP= 000014   	TS$RES= 000040

F.ACTL= 000076   	F.SPDV= 000072   	IS$CRF= ****** GX	N.FVER= 000016   	TS$SLV= 004000

F.ALOC= 000040   	F.SPUN= 000074   	IS$DZR= ****** GX	N.NEXT= 000022   	VT    = 000013

F.BBFS= 000062   	F.STBK= 000036   	IS$WRT= ****** GX	N.STAT= 000020   	WRITE   000470R

F.BDB = 000070   	F.UNIT= 000136   	IX$MAD= ****** GX	N.UNIT= 000034   	W.BATT  000006

F.BGBC= 000057   	F.URBD= 000020   	I$HBCT= ****** GX	OU$FL = ****** GX	W.BFPD  000014

F.BKDN= 000026   	F.VBN = 000064   	I$SFLG= ****** GX	PAR$$$= 000027   	W.BHVR  000004

F.BKDS= 000020   	F.VBSZ= 000060   	I$SLPR= ****** GX	READ    000446R  	W.BLGH  000020

F.BKEF= 000050   	HDBS    000002R  	I$SVBN= ****** GX	R$LDAT  000026   	W.BLPD  000016

F.BKP1= 000051   	HD$SWT= ****** GX	I$XBCT= ****** GX	R$LFLG  000024   	W.BLVR  000002

F.BKST= 000024   	HT    = 000011   	I$XMAD= ****** GX	R$LHGV  000006   	W.BNPD  000015

F.BKVB= 000064   	H.CSP   000000   	LB$BLK= ****** GX	R$LLDZ  000012   	W.BOFF  000012

F.CHR = 000075   	H.CUIC  000010   	LD$ACC= 100000   	R$LMXV  000010   	W.BPCB  000000

F.CNTG= 000034   	H.DSW   000046   	LD$REL= 000004   	R$LMXZ  000014   	W.BSIZ  000010

F.DFNB= 000046   	H.DUIC  000012   	LD$RSV= 040000   	R$LNAM  000000   	$ALBLK= ****** GX

F.DSPT= 000044   	H.EFLM  000004   	LF    = 000012   	R$LOFF  000016   	$CMD  = ****** GX

F.DVNM= 000134   	H.EFSV  000040   	L$BASG  001000   	R$LSA   000004   	$FCMCL= ****** GX

F.EFBK= 000010   	H.FCS   000050   	L$BBLK  000360   	R$LSEG  000022   	$FCMRG  000004RG

F.EFN = 000050   	H.FORT  000052   	L$BDAT  000032   	R$LSIZ  000034   	$INFDB= ****** GX

F.EOBB= 000032   	H.FPSA  000042   	L$BEXT  000352   	R$LWND  000020   	$LBBLK= ****** GX

F.ERR = 000052   	H.FPVA  000034   	L$BFLG  000030   	R$$11M= 000000   	$OPNIN= ****** GX

F.FACC= 000043   	H.GARD  000072   	L$BHGV  000012   	SPA   = 000040   	$OPNOU= ****** GX

F.FFBY= 000014   	H.HDLN  000002   	L$BHRB  000356   	S$V2  = ****** GX	$OPNTK= ****** GX

F.FNAM= 000110   	H.IPC   000016   	L$BLDZ  000016   	S.FATT= 000016   	$OUFDB= ****** GX

F.FNB = 000102   	H.IPS   000014   	L$BLIB  000040   	S.FDB = 000140   	$RLCB = ****** GX

F.FTYP= 000116   	H.ISP   000020   	L$BLUN  000362   	S.FNAM= 000006   	$SAVRG= ****** GX

F.FVER= 000120   	H.LUN   000076   	L$BMXV  000014   	S.FNB = 000036   	$SWTCH= ****** GX

F.HIBK= 000004   	H.NLUN  000074   	L$BMXZ  000020   	S.FNBW= 000017   	$TKBLK= ****** GX

F.LUN = 000042   	H.NML   000061   	L$BOFF  000022   	S.FNTY= 000004   	$TKFDB= ****** GX

F.MBCT= 000054   	H.ODVA  000022   	L$BPAR  000004   	S.FTYP= 000002   	$$    = 000001

F.MBC1= 000055   	H.ODVL  000024   	L$BPRI  000346   	S.NFEN= 000020   	.FSRPT= ****** GX

F.MBFG= 000056   	H.OVLY  000054   	L$BSA   000010   	TK$BLK= ****** GX	.READ = ****** G

F.NRBD= 000024   	H.PFVA  000032   	L$BSEG  000026   	TS$ACP= 020000   	.WAIT = ****** G

F.NREC= 000030   	H.RCVA  000036   	L$BSGL  000354   	TS$CHK= 000100   	.WRITE= ****** G

F.OVBS= 000030   	H.RRVA  000062   	L$BTSK  000000   	TS$CMP= 000200   	...TPC= 000140



. ABS.	001000	   000

      	000562	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  3614 WORDS  ( 15 PAGES)

DYNAMIC MEMORY:  4884 WORDS  ( 18 PAGES)

ELAPSED TIME:  00:00:19

OBJ$:FCMRG,LIS$:FCMRG/-SP=SRC$:MACFLM,LIB$:RSXDF/ML,SRC$:FCMRG

