P5IMG	MACRO M1110  22-AUG-78 01:55  PAGE 3





      1						.TITLE	P5IMG

      2						.IDENT	/11/

      3					                                                                                ;**-1

      4					;

      5					; COPYRIGHT (C) 1978

      6					; COPYRIGHT   1973,  DIGITAL  EQUIPMENT  CORP.,  MAYNARD,   MASS.

      7					; COPYRIGHT   1976,  DIGITAL  EQUIPMENT  CORP.,  MAYNARD,   MASS.

      8					; COPYRIGHT (C) 1977

      9					;

     10					; THIS SOFTWARE IS FURNISHED TO PURCHASER UNDER A LICENSE FOR USE

     11					; ON A  SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH INCLUSION

     12					; OF DEC'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH SYSTEM, EXCEPT

     13					; AS MAY OTHERWISE BE PROVIDED IN WRITING BY DEC.

     14					;

     15					; THE  INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT

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

     17					; EQUIPMENT CORPORATION.

     18					;

     19					; DEC  ASSUMES NO  RESPONSIBILITY  FOR  THE  USE  OR RELIABILITY

     20					; OF ITS  SOFTWARE ON  EQUIPMENT WHICH  IS NOT SUPPLIED BY DEC.

     21					;

     22					; VERSION: 11

     23					;                                                                               ;**-3

     24					; D.N. CUTLER 30-OCT-72

     25					;

     26					;

     27					; MODIFICATIONS:

     28					;

     29					; NO.		DATE		PROGRAMMER

     30					; ---		----		----------

     31					;

     32					; 048		10-FEB-76	C. MONIA

     33					; JAK100	31-JAN-77	; CHANGES FOR MULTIUSER TASKS

     34					; JAK103	 1-APR-77	; ERROR 26 CHANGED TO DIAG. AND SENT ONLY

     35					; JAK116	17-FEB-78	FIX CMPRS FOR R-O LENGTHS > 32K BYTES

     36									; ONCE PER MODULE

     37					;

     38					; PHASE 5 TASK IMAGE OUTPUT ROUTINES

     39					;

     40					; MACRO LIBRARY CALLS

     41					;

     42

     43						.MCALL	READ$,WTSE$S,WRITE$

     44

     45					;

     46					; LOCAL DATA

     47					;

     48

     49	000000	000000 			BLKNM:	.WORD	0		;HIGH ORDER PART OF VIRTUAL BLOCK NUMBER

     50	000002				BLK:	.BLKW	1		;CURRENT DISK BLOCK NUMBER

     51	000004	000000 			BLKNM2:	.WORD	0		; HIGH ORDER PART OF VIRTUAL BLOCK NUMBER	;JAK100

     52	000006				BLK2:	.BLKW	1		; CURRENT DISK BLOCK NUMBER OF SECOND BUFFER	;JAK100

     53	000010				BUF:	.BLKW	256.		;OUTPUT BUFFER

     54		001010'			ENDBUF=.									;JAK100

     55	001010	000001 			BUF2:	.WORD	1		; ADDRESS OF INPUT BUFFER			;JAK100

     56	001012				VDSK:	.BLKW	1		;STARTING DISK ADDR (BYTE)

     57	001014				VEND:	.BLKW	1		;ENDING DISK ADDR (BYTE)

P5IMG	MACRO M1110  22-AUG-78 01:55  PAGE 3-1





     58	001016				IOSTS:	.BLKW	2		;I/O STATUS DOUBLEWORD

     59	001022				ROF:	.BLKW	1		; R-O BUFFER FLAG (0=RW,2=RO)			;JAK100

     60	001024				ERELM:	.BLKW	1		; VIRTUAL ADDRESS OF LAST MODULE TO		;JAK100

     61									; HAVE 'LOAD ADDRESS OUT OF RANGE'		;JAK100

     62

     63

     64					;+

     65					; **-$FINFL-FINISH TASK IMAGE FILE

     66					;

     67					; THIS ROUTINE IS CALLED AT THE END OF PHASE 5 TO FINISH THE WRITING

     68					; OF THE TASK IMAGE FILE. THE CURRENT BUFFER IS FLUSHED AND A SCAN

     69					; OF THE BITMAP IS EXECUTED. A ZERO BLOCK IS WRITTEN INTO THE IMAGE

     70					; FOR EACH BLOCK THAT HAS NOT YET BEEN WRITTEN.

     71					;

     72					; INPUTS:

     73					;

     74					;	NONE.

     75					;

     76					; OUTPUTS:

     77					;

     78					;	WRITING OF THE TASK IMAGE FILE IS FINISHED.

     79					;-

     80

     81	001026				$FINFL::SAVRG			;SAVE NONVOLITILE REGISTERS

     82	001032					CALL	$FLUSH		;FLUSH CURRENT BUFFER

     83	001036					CALL	CLRBF		;CLEAR BUFFER

     84	001042	005001 				CLR	R1		;CLEAR STARTING VIRTUAL BLOCK NUMBER

     85	001044	016702 	000002G			MOV	$BITMP+2,R2	;GET ADDRESS OF BITMAP

     86	001050	016703 	000000G			MOV	$BITMP,R3	;GET SIZE OF BITMAP

     87	001054	012704 	000010 		10$:	MOV	#8.,R4		;SET REPEAT COUNT FOR ONE BYTE

     88	001060	112205 				MOVB	(R2)+,R5	;GET NEXT BITMAP BYTE

     89	001062	005201 			20$:	INC	R1		;INCREMENT VIRTUAL BLOCK NUMBER

     90	001064	006005 				ROR	R5		;CAPTURE LOW BIT IN CARRY

     91	001066	103006 				BCC	30$		;IF CC ALREADY WRITTEN

     92	001070	010167 	176706 			MOV	R1,BLK		;SET VIRTUAL BLOCK NUMBER

     93	001074	005267 	000000G			INC	$BFFLG		;SET BUFFER FLAG "TRUE"

     94	001100					CALL	$FLUSH		;FLUSH BUFFER

     95	001104				30$:	SOB	R4,20$		;REPEAT (BYTE)

     96	001110					SOB	R3,10$		;REPEAT (MAP)

     97	001114	016767 	176662 	000000G		MOV	BLK,$REBLK	; SAVE LAST BLK					;JAK116

     98	001122					RETURN			;

     99

    100					;+

    101					; **-$FLUSH-FLUSH BUFFER

    102					;

    103					; THIS ROUTINE IS CALLED TO FLUSH THE CURRENT CONTENTS OF THE IMAGE

    104					; BUFFER. THE BUFFER IS WRITTEN TO DISK AND THE BUFFER FLAG IS SET

    105					; TO "FALSE".

    106					;

    107					; INPUTS:

    108					;

    109					;	$BFFLG=TRUE/FALSE BUFFER FLAG.

    110					;	BUF=OUTPUT BUFFER.

    111					;

    112					; OUTPUTS:

    113					;

    114					;	THE CURRENT BUFFER IS WRITTEN OUT AND THE BUFFER FLAG IS

P5IMG	MACRO M1110  22-AUG-78 01:55  PAGE 3-2





    115					;	SET TO "FALSE".

    116					;	NOTE: REGISTERS R0 AND R1 ARE NOT DESTROYED.

    117					;-

    118

    119	001124	005767 	000000G		$FLUSH::TST	$BFFLG		;ANYTHING IN BUFFER?

    120	001130	001435 				BEQ	10$		;IF EQ NO

    121	001132	010046 				MOV	R0,-(SP)	;SAVE R0

    122	001134	016700 	000000G			MOV	$TSKPT,R0	;GET TASK IMAGE FILE RECORD BLOCK

    123	001140					WRITE$	R0,#BUF,#<256.*2>,#BLKNM,#1,#IOSTS;WRITE OUT BUFFER

    124	001216					CALL	CHKST		;CHECK WRITE STATUS

    125	001222	012600 				MOV	(SP)+,R0	;RESTORE R0

    126	001224	005067 	000000G		10$:	CLR	$BFFLG		;SET BUFFER FLAG "FALSE"

    127	001230					RETURN			;

    128

    129					;+

    130					; **-$WRBYT-WRITE BYTE INTO TASK IMAGE FILE

    131					;

    132					; THIS ROUTINE IS CALLED TO WRITE A BYTE OF TEXT INTO THE TASK

    133					; IMAGE FILE.

    134					;

    135					; INPUTS:

    136					;

    137					;	R0=VIRTUAL ADDRESS OF THE BYTE TO BE WRITTEN.

    138					;	R1=BYTE TO BE WRITTEN.

    139					;	$CRELM=ADDRESS OF CURRENT ELEMENT DESCRIPTOR.

    140					;	$WRFLG=SEGMENT DESCRIPTOR FLAGS WORD

    141					;

    142					; OUTPUTS:

    143					;

    144					;	BYTE IS WRITTEN INTO THE TASK IMAGE FILE.

    145					;-

    146

    147	001232				$WRBYT::			;

    148	001232	132767 	000000G	000000G		BITB	#SG$DSK,$WRFLG	; SEGMENT HAVE DISK ALLOCATION

    149	001240	001015 				BNE	20$		; IF NE NO

    150	001242				5$:				;

    151	001242	020067 	000000G			CMP	R0,$ENDRW	; IN RW AREA?

    152	001246	101004 				BHI	10$		;IF HI NO

    153

    154						.IF	NDF	R$$11M

    155

    156						CMP	R0,$BEGRW	;WITHIN LIMITS?

    157

    158						.IFF

    159

    160	001250	020067 	000000G			CMP	R0,$LOWRW	; WITHIN LIMITS

    161

    162						.ENDC

    163

    164	001254	103407 				BLO	20$		;IF LO NO

    165	001256	000441 				BR	40$		;

    166	001260	020067 	000000G		10$:	CMP	R0,$BEGRO	;IN RO AREA?

    167	001264	103403 				BLO	20$		;IF LO NO

    168	001266	020067 	000000G			CMP	R0,$ENDRO	;WITHIN LIMITS?

    169	001272	101420 				BLOS	30$		;IF LOS YES

    170	001274				20$:										;JAK103

    171	001274	026767 	000000G	177522 		CMP	$CRELM,ERELM	; MESSAGE PRINTED FOR MODULE			;JAK103

P5IMG	MACRO M1110  22-AUG-78 01:55  PAGE 3-3





    172	001302	001413 				BEQ	25$		; IF EQ YES					;JAK103

    173	001304	016767 	000000G	177512 		MOV	$CRELM,ERELM	; SAVE ADDRESS OF MODULE			;JAK103

    174	001312	016702 	000000G			MOV	$CRELM,R2	; GET ADDRESS OF ELEMENT DESCRIPTOR		;JAK103

    175	001316	062702 	000000G			ADD	#E$LMOD,R2	;POINT TO MODULE NAME

    176	001322	012701 				MOV	(PC)+,R1	;GET ERROR/SEVERITY

    177	001324	   000G	   000G			.BYTE	E$R26,S$V0	; DIAG. MESSAGE					;JAK103

    178	001326	000167 	000000G			JMP	$ERMSG		; PRINT MESSAGE					;JAK103

    179	001332				25$:										;JAK103

    180	001332					RETURN									;JAK103

    181	001334				30$:

    182	001334	166700 	000000G			SUB	$BEGRO,R0	; NORMALIZE TO START OF R-O SEGMENT		;JAK100

    183	001340	012702 	000002 			MOV	#2,R2		; SET FOR R-O					;JAK100

    184	001344	005767 	000000G			TST	$BFFLG		; ANYTHING IN BUFFER?				;JAK100

    185	001350	001425 				BEQ	60$		; IF EQ NO					;JAK100

    186	001352	005767 	177444 			TST	ROF		; CURRENT BUFFER R-O?				;JAK100

    187	001356	001012 				BNE	45$		; IF NE YES					;JAK100

    188	001360	000417 				BR	50$		; NO - FLUSH BUFFER				;JAK100

    189						.IIF  NDF  R$$11M, SUB	$BIAS,R0	; SUBTRACT RO ADDRESS BIAS

    190	001362	166700 	000000G		40$:	SUB	$BEGRW,R0	;NORMALIZE TO START OF SEGMENT

    191						.IIF  NDF  R$$11M, ADD	$HDOFF,R0	; ADD IN HEADER OFFSET

    192	001366	005002 				CLR	R2		; SET FOR R-W					;JAK100

    193	001370	005767 	000000G			TST	$BFFLG		; ANYTHING IN BUFFER?				;JAK100

    194	001374	001413 				BEQ	60$		; IF EQ NO					;JAK100

    195	001376	005767 	177420 			TST	ROF		; CURRENT BUFFER R-W?				;JAK100

    196	001402	001006 				BNE	50$		; IF NE NO - FLUSH				;JAK100

    197	001404				45$:										;JAK100

    198	001404	020067 	177402 			CMP	R0,VDSK		;IN CURRENT BUFFER?

    199	001410	103403 				BLO	50$		;IF LO NO

    200	001412	020067 	177376 			CMP	R0,VEND		;IN CURRENT BUFFER?

    201	001416	101513 				BLOS	80$		;IF LOS YES

    202	001420				50$:	CALL	$FLUSH		;FLUSH CURRENT CONTENTS OF BUFFER

    203	001424				60$:										;JAK100

    204	001424	010267 	177372 			MOV	R2,ROF		; SET FLAG TO CURRENT BUFFER TYPE		;JAK100

    205	001430	010246 				MOV	R2,-(SP)		; SAVE FLAG				;JAK100

    206	001432	062716 	000000G			ADD	#$RLBLK,(SP)	; GET ADDRESS OF RELATIVE BLK			;JAK100

    207	001436	010002 				MOV	R0,R2		; COPY DISK BYE ADDRESS				;JAK100

    208	001440	052702 	000777 			BIS	#777,R2		;CALCULATE ENDING BUFFER ADDRESS

    209	001444	010267 	177344 			MOV	R2,VEND		;SET ENDING BUFFER ADDRESS

    210	001450	042702 	000777 			BIC	#777,R2		;CALCULATE STARTING BUFFER ADDRESS

    211	001454	010267 	177332 			MOV	R2,VDSK		;SET STARTING BUFFER ADDRESS

    212	001460	000302 				SWAB	R2		;DIVIDE BY 256. BYTES

    213	001462	006202 				ASR	R2		;CALCULATE RELATIVE BLOCK NUMBER

    214	001464	063602 				ADD	@(SP)+,R2	; ADD IN BASE RELATIVE BLK NUMBER		;JAK100

    215	001466	005202 				INC	R2		;CONVERT TO VIRTUAL BLOCK NUMBER

    216	001470	010267 	176306 			MOV	R2,BLK		;SET CURRENT BLOCK NUMBER

    217	001474	005267 	000000G			INC	$BFFLG		;SET BUFFER FLAG TO "TRUE"

    218	001500	010046 				MOV	R0,-(SP)	;SAVE R0

    219	001502	010146 				MOV	R1,-(SP)	;SAVE R1

    220	001504	005302 				DEC	R2		;CONVERT TO RELATIVE BLOCK NUMBER

    221

    222

    223						.IF	DF	V1145

    224

    225						MOV	R2,R1		;SET LOW PART OF DIVIDEND

    226						CLR	R0		;CLEAR HIGH PART OF DIVIDEND

    227						DIV	#8.,R0		;CALCULATE RELATIVE BYTE AND BIT

    228

P5IMG	MACRO M1110  22-AUG-78 01:55  PAGE 3-4





    229						.IFF

    230

    231	001506	010200 				MOV	R2,R0		;SET DIVIDEND

    232	001510	012701 	000010 			MOV	#8.,R1		;SET DIVISOR

    233	001514					CALL	$DIV		;CALCULATE RELATIVE BYTE AND BIT

    234

    235						.ENDC

    236

    237

    238	001520	066700 	000002G			ADD	$BITMP+2,R0	;POINT TO BYTE IN BITMAP

    239	001524	012702 	000001 			MOV	#1,R2		;GET MASK BIT

    240

    241

    242						.IF	DF	V1145

    243

    244						ASH	R1,R2		;SHIFT MASK BIT INTO PLACE

    245

    246						.IFF

    247

    248	001530	005301 			65$:	DEC	R1		;DECREMENT SHIFT COUNT

    249	001532	002402 				BLT	70$		;IF LT DONE

    250	001534	006302 				ASL	R2		;SHIFT MASK BIT INTO PLACE

    251	001536	000774 				BR	65$		;

    252

    253						.ENDC

    254

    255

    256	001540	130210 			70$:	BITB	R2,(R0)		;BLOCK ALREADY WRITTEN?

    257	001542	001404 				BEQ	73$		;IF EQ YES

    258	001544	140210 				BICB	R2,(R0)		;CLEAR BIT IN BITMAP

    259	001546					CALL	CLRBF		;CLEAR BUFFER

    260	001552	000433 				BR	77$		;

    261	001554	016700 	000000G		73$:	MOV	$TSKPT,R0	;GET TASK IMAGE FILE RECORD BLOCK

    262	001560					READ$	R0,#BUF,#<256.*2>,#BLKNM,#1,#IOSTS;READ IN BLOCK

    263	001636					CALL	CHKST		;CHECK READ STATUS

    264	001642	012601 			77$:	MOV	(SP)+,R1	;RESTORE R1 AND R0

    265	001644	012600 				MOV	(SP)+,R0	;

    266	001646	166700 	177140 		80$:	SUB	VDSK,R0		;CALCULATE ADDRESS IN BUFFER

    267	001652	110160 	000010'			MOVB	R1,BUF(R0)	;STORE BYTE

    268	001656					RETURN			;

    269

    270					;+

    271					; **-$WRWRD-WRITE WORD INTO TASK IMAGE FILE

    272					;

    273					; THIS ROUTINE IS CALLED TO WRITE A WORD OF TEXT INTO THE TASK

    274					; IMAGE FILE.

    275					;

    276					; INPUTS:

    277					;

    278					;	R0=VIRTUAL ADDRESS OF WORD TO BE WRITTEN.

    279					;	R1=WORD TO BE WRITTEN.

    280					;

    281					; OUTPUTS:

    282					;

    283					;	WORD IS WRITTEN INTO THE TASK IMAGE FILE.

    284					;-

    285

P5IMG	MACRO M1110  22-AUG-78 01:55  PAGE 3-5





    286	001660	010146 			$WRWRD::MOV	R1,-(SP)	;SAVE R0 AND R1

    287	001662	010046 				MOV	R0,-(SP)	;

    288	001664					CALL	$WRBYT		;WRITE FIRST BYTE

    289	001670	012600 				MOV	(SP)+,R0	;RESTORE R0 AND R1

    290	001672	012601 				MOV	(SP)+,R1	;

    291	001674	005200 				INC	R0		;INCREMENT VIRTUAL ADDRESS

    292	001676	000301 				SWAB	R1		;SWAP BYTES

    293	001700					CALL	$WRBYT		;WRITE SECOND BYTE

    294	001704					RETURN			;

    295

    296					;

    297					; SUBROUTINE TO CHECK STATUS OF I/O OPERATION

    298					;

    299

    300	001706	103411 			CHKST:	BCS	10$		;IF CS I/O ERROR

    301	001710					WTSE$S	#1		;WAIT FOR I/O TO COMPLETE

    302	001722	105367 	177070 			DECB	IOSTS		;I/O ERROR?

    303	001726	001001 				BNE	10$		;IF NE YES

    304	001730					RETURN			;

    305	001732	016002 	000000G		10$:	MOV	R$NAME(R0),R2	;GET ADDRESS OF NAME STRING

    306	001736	012701 				MOV	(PC)+,R1	;I/O ERROR

    307	001740	   000G	   000G			.BYTE	E$R25,S$V2	;FATAL-NO RETURN

    308	001742				CHKST1:	CALL	$ERMSG		;OUTPUT ERROR MESSAGE

    309

    310					;

    311					; SUBROUTINE TO CLEAR BUFFER

    312					;

    313

    314	001746	012700 	000010'		CLRBF:	MOV	#BUF,R0		;GET ADDRESS OF BUFFER

    315	001752	012701 	000400 			MOV	#256.,R1	;SET REPEAT COUNT

    316	001756	005020 			10$:	CLR	(R0)+		;CLEAR BUFFER

    317	001760					SOB	R1,10$		;REPEAT

    318	001764					RETURN			;

    319

    320					 										;JAK100

    321					;+										;JAK100

    322					;										;JAK100

    323					; **-$CMPRS-READ ONLY DISK COMPRESSION ROUTINE					;JAK100

    324					;										;JAK100

    325					; THIS ROUTINE IS CALLED AT THE END OF PHASE FIVE 				;JAK100

    326					; TO COMPRESS THE R-O PORTION OF THE TASK FILE.					;JAK100

    327					; BEFORE COMPRESSION EACH R-O SEGMENT STARTED ON				;JAK100

    328					; A BLOCK BOUNDRY,AFTERWARDS THE SEGMENTS ARE CON-				;JAK100

    329					; CATINATED IN THE TASK FILE. THIS FACILATATES 					;JAK100

    330					; LOADING THE SHARED SEGMENTS.							;JAK100

    331					;										;JAK100

    332					; INPUT:									;JAK100

    333					;	R0= RELATIVE BLOCK NUMBER TO OUTPUT COMPRESSED BLKS			;JAK100

    334					;										;JAK100

    335					; OUTPUT:									;JAK100

    336					;	NONE									;JAK100

    337					;										;JAK100

    338					;										;JAK100

    339					;-										;JAK100

    340	001766				$CMPRS::									;JAK100

    341	001766					SAVRG			; SAVE VOLATILE REGISTERS			;JAK100

    342	001772	010004 				MOV	R0,R4		; SAVE OFFSET TO R-W OR R-O			;JAK100

P5IMG	MACRO M1110  22-AUG-78 01:55  PAGE 3-6





    343	001774	005067 	177022 			CLR	ROF		; FLAG USED TO FIRST SEGMENT			;JAK100

    344	002000	012701 	000000G			MOV	#N$DLGH,R1	; GET LENGTH OF BUFFER				;JAK100

    345	002004					CALL	$ALBLK		; ALLOCATE BUFFER SPACE				;JAK100

    346	002010	010067 	176774 			MOV	R0,BUF2		; SET ADDRESS OF BUFFER				;JAK100

    347	002014	012767 	000010'	175764 		MOV	#BUF,BLK2	; SAVE TOP OF OUTPUT BUFFER			;JAK100

    348	002022	012700 	002114'			MOV	#CMPRS,R0	; ADRESS OF COMPRESSION ROUTINE			;JAK100

    349	002026					CALL	$PCTRL		; CALL PHASE CONTROL ROUTINE			;JAK100

    350	002032					CALL	$FLUSH		; WRITE LAST BUFFER				;JAK100

    351	002036	012701 	000000G			MOV	#N$DLGH,R1	; SIZE OF BUFFER				;JAK100

    352	002042	016702 	176742 			MOV	BUF2,R2		; ADDRESS OF BUFFER				;JAK100

    353	002046	012700 	000000G			MOV	#$FRHD,R0	; ADDRESS OF FREE SPACE LISTHEAD		;JAK100

    354	002052					CALL	$RLCB		; RELEASE BUFFER FROM POOL			;JAK100

    355	002056	005067 	176740 			CLR	ROF		; INITIAL FOR NEXT GO ROUND			;JAK100

    356	002062	016767 	175714 	000000G		MOV	BLK,$REBLK	; SAVE LAST BLK AFTER COMPRESSION		;JAK100

    357	002070	005267 	175706 			INC	BLK		; INCREMENT BLOCK COUNT				;JAK100

    358	002074	016700 	000000G			MOV	$TSKPT,R0	; FDB ADDRESS OF TASK FILE			;JAK100

    359	002100	016760 	175676 	000012 		MOV	BLK,F.EFBK+2(R0)	; END OF FILE BLOCK NUMBER		;JAK100

    360	002106					CALL	.TRNCL		; TRUNCATE AND CLOSE TASK FILE			;JAK100

    361	002112					RETURN			; COMPRESSION COMPLETE				;JAK100

    362					 										;JAK100

    363					;+										;JAK100

    364					;										;JAK100

    365					; CMPRS - READS IN R-O SEGMENTS FROM TASK IMAGE FILE AND			;JAK100

    366					;	  REWRITES THEM, ILLIMINATING THE USED PORTIONS.			;JAK100

    367					;										;JAK100

    368					;-										;JAK100

    369	002114				CMPRS:										;JAK100

    370	002114					SAVRG									;JAK100

    371	002120	016702 	175662 			MOV	BLK2,R2		; GET PLACE IN OUT BUFFER			;JAK100

    372	002124	016705 	000000G			MOV	$CRSEG,R5	; SAVE REAL ADDRESS OF SEGMENT			;JAK100

    373	002130	060405 				ADD	R4,R5		; ADD IN R-O OFFSET				;JAK100

    374	002132	016503 	000000G			MOV	S$GRW(R5),R3	; GET R-O (R-W) LENGTH				;JAK100

    375	002136	001535 				BEQ	60$		; IF EQ NO R-O					;JAK100

    376	002140	016567 	000000G	175640 		MOV	S$GBLK(R5),BLK2 ; RELATIVE BLK NUM OF SEGMENT			;JAK100

    377	002146	005267 	175634 			INC	BLK2		;						;JAK100

    378	002152	005004 				CLR	R4		; KEEP COUNT OF BYTES MOVED			;JAK100

    379	002154				5$:										;JAK100

    380	002154	005767 	176642 			TST	ROF		; IS THIS FIRST SEGMENT?			;JAK100

    381	002160	001031 				BNE	45$		; IF NE NO					;JAK100

    382	002162	016767 	175620 	175612 		MOV	BLK2,BLK	; SET RELATIVE BLK NUM FOR OUTPUT		;JAK100

    383	002170	016767 	175612 	000000G		MOV	BLK2,$ROBLK	; SAVE FIRST R-O DISK BLK			;JAK100

    384	002176	005267 	176620 			INC	ROF		; SET NOT FIRST SEGMENT				;JAK100

    385	002202				10$:										;JAK100

    386	002202	000420 				BR 	45$		; GO READ IN BLOCK				;JAK100

    387	002204				20$:										;JAK100

    388	002204	005305 				DEC	R5		; INPUT BUFFER EMPTY?				;JAK100

    389	002206	003414 				BLE	40$		; IF LE YES					;JAK100

    390	002210				25$:										;JAK100

    391	002210	005267 	000000G			INC	$BFFLG		; SET BUFFER NOT EMPTY FLAG			;JAK100

    392	002214	112122 				MOVB	(R1)+,(R2)+	; MOVE BYTE FROM INPUT TO OUTPUT BUFFER		;JAK100

    393	002216	005204 				INC	R4		; KEEP COUNT					;JAK100

    394	002220	020227 	001010'			CMP	R2,#ENDBUF	; OUTPUT BUFFER FULL?				;JAK100

    395	002224	002767 				BLT	20$		; IF NE NO					;JAK100

    396	002226				30$:										;JAK100

    397	002226	010146 				MOV	R1,-(SP)	; SAVE ADDRESS IN INPUT BUFFER			;JAK100

    398	002230					CALL	WRTBLK		; WRITE OUTPUT BUFFER				;JAK100

    399	002234	012601 				MOV	(SP)+,R1	; RESTORE ADDRESS				;JAK100

P5IMG	MACRO M1110  22-AUG-78 01:55  PAGE 3-7





    400	002236	000762 				BR	20$		; GO AGAIN					;JAK100

    401	002240				40$:										;JAK100

    402	002240	005703 				TST	R3		; ANY MORE INPUT BLKS?				;JAK100

    403	002242	001454 				BEQ	50$		; IF EQ NO					;JAK116

    404	002244				45$:										;**-1

    405	002244	010046 				MOV	R0,-(SP)	; SAVE R0					;JAK100

    406	002246	016700 	000000G			MOV	$TSKPT,R0	; GET TASK IMAGE FILE RECORD BLOCK		;JAK100

    407	002252					READ$	R0,BUF2,#<256.*2>,#BLKNM2,#1,#IOSTS  ; READ BLOCK		;JAK100

    408	002330					CALL	CHKST		; CHECK READ STATUS				;JAK100

    409	002334	012600 				MOV	(SP)+,R0	; RESTORE R0					;JAK100

    410	002336	005267 	175444 			INC	BLK2		; INCREMENT RELATIVE BLOCK NUMBER		;JAK100

    411	002342	016701 	176442 			MOV	BUF2,R1		; ADRESS OF INPUT BUFFER			;JAK100

    412	002346	010305 				MOV	R3,R5		;						;JAK100

    413	002350	022703 	001000 			CMP	#<256.*2>,R3	; LESS THEN A BLOCK LEFT?			;JAK116

    414	002354	103402 				BLO	46$		; IF LO NO					;JAK116

    415	002356	005003 				CLR	R3		; SET FOR END 					;JAK116

    416	002360	000713 				BR	25$		;						;JAK116

    417	002362				46$:										;JAK116

    418	002362	162703 	001000 			SUB	#<256.*2>,R3	; GET LENGTH OF BLK				;JAK100

    419	002366	012705 	001000 			MOV	#<256.*2>,R5	; LOOP COUNT WAS LARGER THEN BUFFER SIZE	;**-1

    420	002372	000706 				BR	25$		; GO PROCESS BLOCK READ				;JAK100

    421	002374				50$:										;JAK100

    422	002374	010400 				MOV	R4,R0		;						;JAK100

    423	002376	052704 	000077 			BIS	#77,R4		; MOVE TO A 32 WORD BOUNDARY			;JAK100

    424	002402	005204 				INC	R4		;						;JAK100

    425	002404	160004 				SUB	R0,R4		;						;JAK100

    426	002406	060402 				ADD	R4,R2		;						;JAK100

    427	002410	010267 	175372 			MOV	R2,BLK2		; SAVE POSITION IN OUT BUFFER			;JAK100

    428	002414	020227 	001010'			CMP	R2,#ENDBUF	; GO PAST END OF BUFFER?			;JAK100

    429	002420	002404 				BLT	60$		; IF LT	NO					;JAK100

    430	002422					CALL	WRTBLK		; WRITE OUT BUFFER				;JAK100

    431	002426	010267 	175354 			MOV	R2,BLK2		; GET ADDRESS IN BUFFER				;JAK100

    432	002432				60$:										;JAK100

    433	002432					RETURN									;JAK100

    434					 										;JAK100

    435					 										;JAK100

    436	002434				WRTBLK:				; FLUSH BUFFER					;JAK100

    437	002434					CALL	$FLUSH		;						;JAK100

    438	002440	005267 	175336 			INC	BLK		; INCREMENT BLOCK NUMBER			;JAK100

    439	002444	012702 	000010'			MOV	#BUF,R2		; ADDRESS OF OUT BUFFER				;JAK100

    440	002450					CALL	CLRBF		; INITIALIZE OUTPUT BUFFER			;JAK100

    441	002454					RETURN									;JAK100

    442					 										;JAK100

    443					 										;JAK100

    444		000001 				.END

P5IMG	MACRO M1110  22-AUG-78 01:55  PAGE 3-8

SYMBOL TABLE



BLK     000002R  	FD.DIR= 000010   	F.BKVB= 000064   	LF    = 000012   	S.FNTY= 000004

BLKNM   000000R  	FD.FTN= 000001   	F.CHR = 000075   	NB.DEV= 000200   	S.FTYP= 000002

BLKNM2  000004R  	FD.F11= 040000   	F.CNTG= 000034   	NB.DIR= 000100   	S.NFEN= 000020

BLK2    000006R  	FD.INS= 000010   	F.DFNB= 000046   	NB.NAM= 000004   	VDSK    001012R

BUF     000010R  	FD.ISP= 002000   	F.DSPT= 000044   	NB.SD1= 000400   	VEND    001014R

BUF2    001010R  	FD.MNT= 100000   	F.DVNM= 000134   	NB.SD2= 001000   	VT    = 000013

B.BBFS= 000010   	FD.OSP= 004000   	F.EFBK= 000010   	NB.SNM= 000040   	WRTBLK  002434R

B.BFST= 000015   	FD.PLC= 000004   	F.EFN = 000050   	NB.STP= 000020   	$ALBLK= ****** GX

B.NXBD= 000012   	FD.PRN= 000004   	F.EOBB= 000032   	NB.SVR= 000010   	$BEGRO= ****** GX

B.VBN = 000004   	FD.PSE= 010000   	F.ERR = 000052   	NB.TYP= 000002   	$BEGRW= ****** GX

CHKST   001706R  	FD.RAH= 000001   	F.FACC= 000043   	NB.VER= 000001   	$BFFLG= ****** GX

CHKST1  001742R  	FD.RAN= 000002   	F.FFBY= 000014   	N$DLGH= ****** GX	$BITMP= ****** GX

CH.AND= 000001   	FD.REC= 000001   	F.FNAM= 000110   	N.DID = 000024   	$CMPRS  001766RG

CLRBF   001746R  	FD.RWM= 000001   	F.FNB = 000102   	N.DVNM= 000032   	$CRELM= ****** GX

CMPRS   002114R  	FD.SDI= 000020   	F.FTYP= 000116   	N.FID = 000000   	$CRSEG= ****** GX

CR    = 000015   	FD.SQD= 000040   	F.FVER= 000120   	N.FNAM= 000006   	$DIV  = ****** GX

ENDBUF= 001010R  	FD.TTY= 000004   	F.HIBK= 000004   	N.FTYP= 000014   	$ENDRO= ****** GX

ERELM   001024R  	FD.WBH= 000002   	F.LUN = 000042   	N.FVER= 000016   	$ENDRW= ****** GX

E$LMOD= ****** GX	FF    = 000014   	F.MBCT= 000054   	N.NEXT= 000022   	$ERMSG= ****** GX

E$R25 = ****** GX	FF.CHR= 000005   	F.MBC1= 000055   	N.STAT= 000020   	$FINFL  001026RG

E$R26 = ****** GX	FF.NV = 000003   	F.MBFG= 000056   	N.UNIT= 000034   	$FLUSH  001124RG

FA.APD= 000100   	FF.POE= 000002   	F.NRBD= 000024   	PAR$$$= 000000   	$FRHD = ****** GX

FA.CRE= 000010   	FF.RWD= 000001   	F.NREC= 000030   	ROF     001022R  	$LOWRW= ****** GX

FA.DLK= 001000   	FF.RWF= 000006   	F.OVBS= 000030   	R$NAME= ****** GX	$PCTRL= ****** GX

FA.ENB= 100000   	FF.SPC= 000004   	F.RACC= 000016   	R$$11M= 000000   	$REBLK= ****** GX

FA.EXC= 002000   	FO.APD= 000106   	F.RATT= 000001   	R.FIX = 000001   	$RLBLK= ****** GX

FA.EXT= 000004   	FO.MFY= 000002   	F.RCNM= 000034   	R.SEQ = 000003   	$RLCB = ****** GX

FA.NSP= 000100   	FO.RD = 000001   	F.RCTL= 000017   	R.VAR = 000002   	$ROBLK= ****** GX

FA.POS= 010000   	FO.UPD= 000006   	F.RSIZ= 000002   	SG$DSK= ****** GX	$SAVRG= ****** GX

FA.RD = 000001   	FO.WRT= 000016   	F.RTYP= 000000   	SPA   = 000040   	$TSKPT= ****** GX

FA.RWD= 004000   	F.ACTL= 000076   	F.SEQN= 000100   	S$GBLK= ****** GX	$WRBYT  001232RG

FA.SEQ= 040000   	F.ALOC= 000040   	F.SPDV= 000072   	S$GRW = ****** GX	$WRFLG= ****** GX

FA.SHR= 000040   	F.BBFS= 000062   	F.SPUN= 000074   	S$V0  = ****** GX	$WRWRD  001660RG

FA.TMP= 000020   	F.BDB = 000070   	F.STBK= 000036   	S$V2  = ****** GX	$$    = 000001

FA.WCK= 020000   	F.BGBC= 000057   	F.UNIT= 000136   	S.BFHD= 000020   	.READ = ****** G

FA.WRT= 000002   	F.BKDN= 000026   	F.URBD= 000020   	S.FATT= 000016   	.TRNCL= ****** GX

FD.BLK= 000010   	F.BKDS= 000020   	F.VBN = 000064   	S.FDB = 000140   	.WRITE= ****** G

FD.CCL= 000002   	F.BKEF= 000050   	F.VBSZ= 000060   	S.FNAM= 000006   	...GBL= 000000

FD.COM= 020000   	F.BKP1= 000051   	HT    = 000011   	S.FNB = 000036   	...TPC= 000140

FD.CR = 000002   	F.BKST= 000024   	IOSTS   001016R  	S.FNBW= 000017



. ABS.	000000	   000

      	002456	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  2716 WORDS  ( 11 PAGES)

DYNAMIC MEMORY:  3828 WORDS  ( 14 PAGES)

ELAPSED TIME:  00:00:27

OBJ$:P5IMG,LIS$:P5IMG/-SP=SRC$:MACFLM,FCSPR,P5IMG

