Google
 

Trailing-Edge - PDP-10 Archives - AP-4178E-RM - swskit-sources/copy.lis
There is 1 other file named copy.lis in the archive. Click here to see a list.
.MAIN.	MACRO M1108  16-JAN-78 19:45
TABLE OF CONTENTS

    2-   1	TITLE PAGE
    3-  43	MACROS AND PARAMETERS
    4-  90	COPY TASK IMPURE DATA AREA
    5- 143	INITIALIZATION
    6- 202	PARSE COMMAND LINE
    7- 309	CHECK OUT OUR DEVICES
    8- 328	DISPATCH TO ACTION ROUTINES
    9- 357	COPY, VERIFY, COPY & VERIFY (/CP, /VF, /CP/VF)
   10- 447	SPECIFICATION ERRORS
   11- 461	READ, ZERO (/RD, /ZE)
   12- 503	^C CHECK AND DONE
   13- 528	I/O ROUTINES
   14- 643	COMMAND PARSER ROUTINES
   15- 727	TYPEOUT ROUTINES
   16- 912	END STATEMENT
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 2
TITLE PAGE

      1						.SBTTL	TITLE PAGE
      2						.TITLE	COPY -- MCR FUNCTION 'COP' FOR RSX-20F
      3					.IDENT	"V003A"
      4					;
      5					;
      6					;
      7					;
      8					;                             COPYRIGHT (C) 1975, 1978 BY
      9					;                     DIGITAL EQUIPMENT CORPORATION, MAYNARD MASS.
     10					;
     11					;       THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE  USED  AND  COPIED
     12					;       ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE INCLUSION
     13					;       OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY OTHER COPIES THERE-
     14					;       OF  MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON.
     15					;       NO TITLE TO OR OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.
     16					;
     17					;       THE INFORMATION CONTAINED IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT
     18					;       NOTICE  AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
     19					;       CORPORATION.
     20					;
     21					;       DIGITAL ASSUMES NO RESPONSIBILITY FOR THE  USE  OR  RELIABILITY  OF  ITS
     22					;       SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPILED BY DIGITAL.
     23					;
     24					;
     25					;
     26					;
     27					;
     28					;
     29					;		MODULE: MCR FUNCTION -- COP
     30					;
     31					;		VERSION: V001A
     32					;
     33					;		AUTHOR: TOM PORCHER
     34					;
     35					;		DATE: 29-APR-76
     36					;
     37					;
     38					;	THIS MODULE CONTAINS:
     39					;
     40					;	-- COMMAND PARSER FOR COP
     41					;
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 3
MACROS AND PARAMETERS

     43						.SBTTL	MACROS AND PARAMETERS
     44					;
     45					; ASSEMBLY CONDITIONS
     46					;
     47						.LIST	MEB
     48						.ENABLE	AMA
     49					;
     50					; MISC. .MCALLS
     51					;
     52					.MCALL ALUN$S,CLEF$S,EXIT$S,GPRT$S,QIOW$S,QIO$S,WTSE$S,CALL,RETURN,PUSH,POP
     53					;
     54					; MACROS
     55					;
     56					.MACRO	TYPE	MSG,ARG
     57						.PSECT	TEXT
     58					$$$=.
     59						.ASCIZ	"MSG"
     60						.PSECT
     61						PUSH	#$$$
     62					.IF NB <ARG>
     63						CALL	TYP'ARG
     64					.IFF
     65						CALL	TYPMSG
     66					.ENDC
     67					.ENDM	TYPE
     68					;
     69					.MACRO	ERROR	MSG
     70						TYPE	<"<11>"MSG"<5>">
     71					.ENDM	ERROR
     72					;
     73					.MACRO	WARN	MSG
     74						TYPE	<"<12>"MSG"<1>">
     75					.ENDM	WARN
     76					;
     77					;
     78					; PARAMETERS
     79					;
     80					;
     81					; LOGICAL UNIT AND EVENT FLAG ASSIGNMENTS
     82					;
     83		000001 			CTYLUN=	1			;LUN FOR CTY
     84		000001 			E.FCTY=	CTYLUN			;ALSO EFN FOR CTY
     85		000002 			SRCLUN=	2			;LUN FOR INPUT
     86		000002 			E.FSRC=	SRCLUN			;ALSO EFN FOR INPUT
     87		000003 			DSTLUN=	3			;LUN FOR OUTPUT
     88		000003 			E.FDST=	DSTLUN			;ALSO EFN FOR OUTPUT
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 4
COPY TASK IMPURE DATA AREA

     90						.SBTTL	COPY TASK IMPURE DATA AREA
     91					;
     92					; VARIBLES
     93					;
     94	000000				SPSAVE:	.BLKW	1		;STACK POINTER SAVE
     95	000002				RADIX:	.BLKW	1		;OUTPUT NUMBER RADIX
     96		000004'			CMDCLR=.
     97	000004				QIOSTS:	.BLKW	2		;QIO STATUS BLOCK
     98					;
     99					; *** SRCXXX AND DSTXXX MUST REMAIN IN SAME ORDER
    100					;
    101	000010				SRCBLK:	.BLKW	2		;INPUT BLOCK #
    102	000014				SRCDEV:	.BLKW	1		;INPUT DEVICE IN ASCII
    103	000016				SRCUNT:	.BLKB	1		;INPUT UNIT #
    104	000017				SRCNBF:	.BLKB	1		;1-- DON'T BLOCK (DO QIO$)
    105									;0-- BLOCK (DO QIOW$)
    106									;-1-- WAIT FOR LAST NON-BLOCK REQUEST (DO WTSE$)
    107						.EVEN
    108	000020				DSTBLK:	.BLKW	2		;OUTPUT BLOCK #
    109	000024				DSTDEV:	.BLKW	1		;OUTPUT DEVICE
    110	000026				DSTUNT:	.BLKB	1		; . .
    111	000027				DSTNBF:	.BLKB	1		;OUTPUT NO-BLOCK FLAG
    112					;
    113	000030				EOVFLG:	.BLKB	1		;1-- END-OF-VOLUME REACHED ON A DEVICE
    114	000031				CTZFLG:	.BLKB	1		;^Z SEEN ON INPUT-- EXIT WHEN DONE
    115	000032				HEFLAG:	.BLKB	1		;1-- TYPE HELP MESSAGE
    116						.EVEN
    117	000034				CPVFLG:
    118	000034				CPFLAG:	.BLKB	1		;1-- COPY FILES
    119	000035				VFFLAG:	.BLKB	1		;1-- VERIFY
    120						.EVEN
    121	000036				RDZFLG:
    122	000036				RDFLAG:	.BLKB	1		;1-- JUST READ
    123	000037				ZEFLAG:	.BLKB	1		;1-- ZERO DESTINATION DEVICE
    124		000034 			CMDCLN=.-CMDCLR
    125					;
    126					; BUFFERS
    127					;
    128	000040				TYPBUF:	.BLKB	100.		;BUFFER FOR CTY OUTPUT
    129	000204				CTYBUF:	.BLKB	80.		;BUFFER FOR INPUT FROM CTY
    130		000120 			CTYBFL=	.-CTYBUF
    131	000324	   000 				.BYTE	0		;TO MAKE ASCIZ ALWAYS
    132						.EVEN
    133					;
    134					; BUFFER POINTERS TO THE END OF OUR TASK PARTITION
    135					;
    136	000326				BUFSIZ:	.BLKW	1		;BUFFER SIZE
    137	000330				BUFSZ2:	.BLKW	1		;BUFFER SIZE/2
    138	000332				BUFSZ4:	.BLKW	1		;BUFFER SIZE/4
    139	000334				BUFBL4:	.BLKW	1		;BUFFER SIZE IN BLOCKS/4
    140	000336	000000 	000000 		BUFEND:	.LIMIT			;END OF BUFFER
    141		000340'			BUFADR=.-2			;BUFFER ADDRESS (STORED BY TASK BUILDER)
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 5
INITIALIZATION

    143						.SBTTL	INITIALIZATION
    144					;
    145					; REQUEST FOR COPY BY MCR COP COMMAND CALLS COPY HERE
    146					;
    147	000342				COPY:
    148	000342	010637 	000000'			MOV	SP,SPSAVE	;SAVE CURRENT STACK POINTER
    149					;
    150					; SETUP COMMAND DEFAULTS
    151					;
    152	000346	012701 	000004'			MOV	#CMDCLR,R1	;GET START OF AREA TO CLEAR
    153	000352	012705 	000034 			MOV	#CMDCLN,R5	;AND LENGTH OF AREA, IN BYTES
    154	000356				10$:
    155	000356	105021 				CLRB	(R1)+		;CLEAR A BYTE
    156	000360	077502 				SOB	R5,10$		;CLEAR 'EM ALL
    157					;
    158					; GET BUFFER SIZE
    159					;
    160	000362	012700 	000326'			MOV	#BUFSIZ,R0	;GET ADDRESS OF BUFFER SIZE AREA
    161	000366					GPRT$S	,R0		;GET OUR PARTITION PARAMETERS
	000366	010046 				MOV	R0,-(SP)
	000370	005046 				CLR	-(SP)
	000372	005046 				CLR	-(SP)
	000374	012746 				MOV	(PC)+,-(SP)
	000376	   101 	   004 			.BYTE	65.,4
	000400	104375 				EMT	375
    162	000402	103466 				BCS	EXITC		;BLEAH!!
    163	000404	013720 	000000G			MOV	@#$DSW,(R0)+	;WE WANT VIRTUAL ADDRESS
    164		000006 			.REPT 6
    165						ASL	(R0)		;SHIFT TO BYTES FROM 1/64
    166					.ENDR
	000410	006310 				ASL	(R0)		;SHIFT TO BYTES FROM 1/64
	000412	006310 				ASL	(R0)		;SHIFT TO BYTES FROM 1/64
	000414	006310 				ASL	(R0)		;SHIFT TO BYTES FROM 1/64
	000416	006310 				ASL	(R0)		;SHIFT TO BYTES FROM 1/64
	000420	006310 				ASL	(R0)		;SHIFT TO BYTES FROM 1/64
	000422	006310 				ASL	(R0)		;SHIFT TO BYTES FROM 1/64
    167	000424	061040 				ADD	(R0),-(R0)	;GET LAST ADDRESS IN PARITION
    168	000426	163710 	000340'			SUB	BUFADR,(R0)	;COMPUTE BUFFER SIZE
    169	000432	042710 	003777 			BIC	#<4*1000>-1,(R0) ;(BUFSIZ) ROUND DOWN TO 4 BLOCK BOUNDARY
    170	000436	011001 				MOV	(R0),R1		;COPY THAT
    171	000440	012010 				MOV	(R0)+,(R0)	;(BUFSZ2) COPY SIZE
    172	000442	000241 				CLC			;CLEAR THE NEW BIT
    173	000444	006010 				ROR	(R0)		;(BUFSZ2) MAKE THAT SIZE/2
    174	000446	012010 				MOV	(R0)+,(R0)	;(BUFSZ4) COPY IT AGAIN
    175	000450	006010 				ROR	(R0)		;(BUFSZ4) SIZE/4
    176	000452	012010 				MOV	(R0)+,(R0)	;(BUFBL4)  AND AGAIN
    177	000454	000310 				SWAB	(R0)		;(BUFBL4) MAKE THAT # BLOCKS IN BUFFER/2
    178	000456	006020 				ROR	(R0)+		;(BUFBL4)  BLOCKS/4
    179	000460	010120 				MOV	R1,(R0)+	;(BUFEND) GET SIZE AGAIN
    180	000462	061040 				ADD	(R0),-(R0)	;(BUFEND) COMPUTE END OF BUFFER
    181					;
    182					; SETUP TO READ A LINE FROM THE CTY
    183					;
    184	000464					ALUN$S	#CTYLUN,#"TT,#0	;ASSIGN CTY TO LUN 1
	000464	005046 				CLR	-(SP)
	000466	012746 	052124 			MOV	#"TT,-(SP)
	000472	012746 	000001 			MOV	#CTYLUN,-(SP)
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 5-1
INITIALIZATION

	000476	012746 				MOV	(PC)+,-(SP)
	000500	   007 	   004 			.BYTE	7.,4
	000502	104375 				EMT	375
    185	000504	103425 				BCS	EXITC		;GIVE UP IF NO CTY!!!!
    186	000506					TYPE	^\COP>\		;TYPE PROMPT MESSAGE
	000000	   103 	   117 	   120 		.ASCIZ	"COP>"
	000003	   076 	   000
	000506	012746 	000000'			MOV	#$$$,-(SP)
	000512	004737 	002754'			JSR	PC,TYPMSG
    187	000516					QIOW$S	#IO.RLB,#CTYLUN,#E.FCTY,,#QIOSTS,,<#CTYBUF,#CTYBFL>
	000516	012746 	000120 			MOV	#CTYBFL,-(SP)
	000522	012746 	000204'			MOV	#CTYBUF,-(SP)
	000526	005046 				CLR	-(SP)
	000530	012746 	000004'			MOV	#QIOSTS,-(SP)
	000534	005046 				CLR	-(SP)
	000536	112716 	000001 			MOVB	#E.FCTY,(SP)
	000542	012746 	000001 			MOV	#CTYLUN,-(SP)
	000546	012746 	000000G			MOV	#IO.RLB,-(SP)
	000552	012746 				MOV	(PC)+,-(SP)
	000554	   003 	   010 			.BYTE	3,$$$T1
	000556	104375 				EMT	375
    188	000560				EXITC:
    189	000560	103571 				BCS	EXITA		;GIVE UP IF FAILURE
    190	000562	105737 	000004'			TSTB	QIOSTS+0	;ERROR STATUS
    191	000566	003006 				BGT	10$		;NO-- GO ON
    192	000570	123727 	000004'	000000G		CMPB	QIOSTS+0,#IE.EOF ;^Z??
    193	000576	001162 				BNE	EXITA		;NO-- GIVE UP NOW
    194	000600	105237 	000031'			INCB	CTZFLG		;YES-- SAY TO EXIT WHEN DONE
    195	000604				10$:
    196	000604					TYPE	<"<1>">		;INSURE A <CR><LF>
	000005	   001 	   000 			.ASCIZ	""<1>""
	000604	012746 	000005'			MOV	#$$$,-(SP)
	000610	004737 	002754'			JSR	PC,TYPMSG
    197	000614	013704 	000006'			MOV	QIOSTS+2,R4	;GET # CHARACTERS TYPED AT ME
    198	000620	105064 	000204'			CLRB	CTYBUF(R4)	;CLEAR LAST BYTE OF INPUT (MAKE ASCIZZZ)
    199	000624	012704 	000204'			MOV	#CTYBUF,R4	;POINT TO START OF INPUT TO PARSE
    200					;	BR	PARSE		;PARSE THE LINE
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 6
PARSE COMMAND LINE

    202						.SBTTL	PARSE COMMAND LINE
    203					;
    204					; NOW TO PARSE THE LINE, BUFFER ADDRESS IN R4
    205					;
    206	000630				PARSE:
    207	000630					CALL	GETNB		;GET NON-BLANK CHARACTER
	000630	004737 	002622'			JSR	PC,GETNB
    208	000634	001002 				BNE	10$		;GOT SOMETHING-- GO ON
    209	000636	000137 	002152'			JMP	DONE		;NULL COMMAND-- JUST DONE
    210	000642				10$:
    211	000642					CALL	GETNAM		;GET A DEVICE NAME
	000642	004737 	002644'			JSR	PC,GETNAM
    212	000646	103552 				BCS	SYNERR		;NO SUCH LUCK
    213	000650	010037 	000024'			MOV	R0,DSTDEV	;COPY THE TYPED NAME
    214	000654	001411 				BEQ	20$		;NOT SPEC-- SEE IF =
    215	000656					CALL	GETNUM		;GET UNIT NUMBER OF DEVICE (IF ANY)
	000656	004737 	002710'			JSR	PC,GETNUM
    216	000662	103544 				BCS	SYNERR		;TOO BIG-- COMPLAIN
    217	000664	110037 	000026'			MOVB	R0,DSTUNT	;COPY THE UNIT NUMBER
    218	000670	122724 	000072 			CMPB	#':,(R4)+	; : FOLLOWING DEVICE?
    219	000674	001401 				BEQ	20$		;YES-- IGNORE IT
    220	000676	105744 				TSTB	-(R4)		;NO-- GO BACK TO LOOK AT IT AGAIN
    221	000700				20$:
    222	000700					CALL	GETNB		;GET NON-BLANK CHARACTER
	000700	004737 	002622'			JSR	PC,GETNB
    223	000704	001540 				BEQ	CMDONE		;ALL DONE IF EOL
    224	000706	122700 	000075 			CMPB	#'=,R0		;THIS = SPEC?
    225	000712	001023 				BNE	25$		;NO-- TRY FOR SWITCHES
    226	000714	105724 				TSTB	(R4)+		;YES-- SKIP IT
    227	000716					CALL	GETNB		;GET NON-BLANK
	000716	004737 	002622'			JSR	PC,GETNB
    228	000722	001531 				BEQ	CMDONE		;EOL-- ALL DONE
    229	000724					CALL	GETNAM		;GET A DEVICE NAME
	000724	004737 	002644'			JSR	PC,GETNAM
    230	000730	103521 				BCS	SYNERR		;NO SUCH LUCK
    231	000732	010037 	000014'			MOV	R0,SRCDEV	;COPY THE TYPED NAME
    232	000736	001411 				BEQ	25$		;NONE-- TRY FOR SWITCHES
    233	000740					CALL	GETNUM		;GET UNIT NUMBER OF DEVICE (IF ANY)
	000740	004737 	002710'			JSR	PC,GETNUM
    234	000744	103513 				BCS	SYNERR		;TOO BIG-- COMPLAIN
    235	000746	110037 	000016'			MOVB	R0,SRCUNT	;COPY THE UNIT NUMBER
    236	000752	122724 	000072 			CMPB	#':,(R4)+	; : FOLLOWING DEVICE?
    237	000756	001401 				BEQ	25$		;YES-- IGNORE IT
    238	000760	105744 				TSTB	-(R4)		;NO-- GO BACK TO LOOK AT IT AGAIN
    239					;
    240					; LOOK FOR ALL SWITCHES
    241					;
    242	000762				25$:
    243	000762					CALL	GETNB		;SKIP BLANKS AFTER UNIT
	000762	004737 	002622'			JSR	PC,GETNB
    244	000766	001507 				BEQ	CMDONE		;END OF COMMAND-- ALL OK
    245	000770	122700 	000057 			CMPB	#'/,R0		;THIS A SWITCH?
    246	000774	001077 				BNE	SYNERR		;NO-- BAD CHARACTER
    247	000776	105724 				TSTB	(R4)+		;YES-- SKIP OVER IT
    248	001000	012702 	000001 			MOV	#1,R2		;ASSUME NOT /-(SW)
    249	001004	122714 	000055 			CMPB	#'-,(R4)	;THIS /-(SW)?
    250	001010	001002 				BNE	30$		;NO-- GO ON
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 6-1
PARSE COMMAND LINE

    251	001012	105724 				TSTB	(R4)+		;YES-- SKIP OVER -
    252	001014	005002 				CLR	R2		;AND SET TO CLEAR THE FLAG
    253	001016				30$:
    254	001016					CALL	GETNAM		;GET THE SWITCH
	001016	004737 	002644'			JSR	PC,GETNAM
    255	001022	103464 				BCS	SYNERR		;TOO LONG-- GIVE UP
    256	001024	022700 	046102 			CMP	#"BL,R0		;/BL:NNNN?
    257	001030	001027 				BNE	39$		;NO-- GO ON
    258	001032	122714 	000072 			CMPB	#':,(R4)	;THIS /BL:?
    259	001036	001056 				BNE	SYNERR		;NO DICE
    260	001040				32$:
    261	001040	105724 				TSTB	(R4)+		;YES-- OK
    262	001042					CALL	GETNB		;GET THE BLANKS
	001042	004737 	002622'			JSR	PC,GETNB
    263	001046	001452 				BEQ	SYNERR		;OOPS
    264	001050					CALL	GETNUM		;GET THE NUMBER
	001050	004737 	002710'			JSR	PC,GETNUM
    265	001054	103447 				BCS	SYNERR		;OOPS
    266	001056	122714 	000054 			CMPB	#',,(R4)	;THIS N,NNN?
    267	001062	001005 				BNE	35$		;NO-- GO ON
    268	001064	110037 	000010'			MOVB	R0,SRCBLK+0	;YES-- SET SRC BLOCK (HIGH PART)
    269	001070	110037 	000020'			MOVB	R0,DSTBLK+0	; AND DESTINATION
    270	001074	000761 				BR	32$		;LOOP FOR LOW PART
    271					;
    272	001076				35$:
    273	001076	010037 	000012'			MOV	R0,SRCBLK+2	;SAVE LOW PART
    274	001102	010037 	000022'			MOV	R0,DSTBLK+2	; . .
    275	001106	000725 				BR	25$		;LOOP FOR MORE SWITCHES
    276					;
    277	001110				39$:
    278	001110	012701 	001150'			MOV	#MODTBL,R1	;GET ADDRESS OF SWITCH TABLE
    279	001114	012705 	000005 			MOV	#MODTLN,R5	; AND LENGTH OF IT
    280	001120				40$:
    281	001120	020021 				CMP	R0,(R1)+	;THIS SWITCH MATCH?
    282	001122	001002 				BNE	50$		;NO-- LOOP FOR MORE
    283	001124	110231 				MOVB	R2,@(R1)+	;YES-- SET THE FLAG AS REQUESTED
    284	001126	000715 				BR	25$		;LOOP FOR ALL SWITCHES
    285					;
    286	001130				50$:
    287	001130	005721 				TST	(R1)+		;NO-- SKIP OVER FLAG ADDRESS
    288	001132	077506 				SOB	R5,40$		;NO-- LOOP FOR ALL SWITCHES
    289	001134					ERROR	<ILLEGAL SWITCH /"<2>">
	000007	   011 	   111 	   114 		.ASCIZ	""<11>"ILLEGAL SWITCH /"<2>""<5>""
	000012	   114 	   105 	   107
	000015	   101 	   114 	   040
	000020	   123 	   127 	   111
	000023	   124 	   103 	   110
	000026	   040 	   057 	   002
	000031	   005 	   000
	001134	012746 	000007'			MOV	#$$$,-(SP)
	001140	004737 	002754'			JSR	PC,TYPMSG
    290	001144				EXITA:
    291	001144	000137 	003406'			JMP	EXIT		;TOO FAR TO HOP
    292					;
    293					; SWITCH TABLE
    294					;
    295	001150				MODTBL:
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 6-2
PARSE COMMAND LINE

    296					.IRP	ARG,<CP,HE,RD,VF,ZE>
    297						.ASCII	/ARG/
    298						.EVEN
    299						.WORD	ARG'FLAG
    300					.ENDM
	001150	   103 	   120 			.ASCII	/CP/
	001152	000034'				.WORD	CPFLAG
	001154	   110 	   105 			.ASCII	/HE/
	001156	000032'				.WORD	HEFLAG
	001160	   122 	   104 			.ASCII	/RD/
	001162	000036'				.WORD	RDFLAG
	001164	   126 	   106 			.ASCII	/VF/
	001166	000035'				.WORD	VFFLAG
	001170	   132 	   105 			.ASCII	/ZE/
	001172	000037'				.WORD	ZEFLAG
    301		000005 			MODTLN=<.-MODTBL>/4
    302					;
    303					; COMMAND ERRORS
    304					;
    305	001174				SYNERR:
    306	001174	010400 				MOV	R4,R0		;POINT INPUT STRING TO OUTPUT STRING
    307	001176					ERROR	<SYNTAX ERROR: "<4>">
	000033	   011 	   123 	   131 		.ASCIZ	""<11>"SYNTAX ERROR: "<4>""<5>""
	000036	   116 	   124 	   101
	000041	   130 	   040 	   105
	000044	   122 	   122 	   117
	000047	   122 	   072 	   040
	000052	   004 	   005 	   000
	001176	012746 	000033'			MOV	#$$$,-(SP)
	001202	004737 	002754'			JSR	PC,TYPMSG
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 7
CHECK OUT OUR DEVICES

    309						.SBTTL	CHECK OUT OUR DEVICES
    310					;
    311					; THE COMMAND STRING IS NOW PARSED.  CHECK OUT THE DEVICE HE SPECIFIED.
    312					;
    313	001206				CMDONE:
    314	001206	012705 	000014'			MOV	#SRCDEV,R5	;ALSO INPUT
    315	001212	005725 				TST	(R5)+		;SPECIFIED?
    316	001214	001410 				BEQ	10$		;NO-- SKIP IT
    317	001216					ALUN$S	#SRCLUN,-(R5),(R5)
	001216	011546 				MOV	(R5),-(SP)
	001220	014546 				MOV	-(R5),-(SP)
	001222	012746 	000002 			MOV	#SRCLUN,-(SP)
	001226	012746 				MOV	(PC)+,-(SP)
	001230	   007 	   004 			.BYTE	7.,4
	001232	104375 				EMT	375
    318	001234	103414 				BCS	DNSERR		;OOPS
    319	001236				10$:
    320	001236	012705 	000024'			MOV	#DSTDEV,R5	;POINT TO OUTPUT DEVICE
    321	001242	005725 				TST	(R5)+		;SPEC?
    322	001244	001414 				BEQ	GOTDEV		;NO-- SKIP IT
    323	001246					ALUN$S	#DSTLUN,-(R5),(R5) ;ASSIGN IT
	001246	011546 				MOV	(R5),-(SP)
	001250	014546 				MOV	-(R5),-(SP)
	001252	012746 	000003 			MOV	#DSTLUN,-(SP)
	001256	012746 				MOV	(PC)+,-(SP)
	001260	   007 	   004 			.BYTE	7.,4
	001262	104375 				EMT	375
    324	001264	103004 				BCC	GOTDEV		;GOT IT-- OK
    325	001266				DNSERR:
    326	001266					ERROR	<DEVICE "<3>" NOT IN SYSTEM>
	000055	   011 	   104 	   105 		.ASCIZ	""<11>"DEVICE "<3>" NOT IN SYSTEM"<5>""
	000060	   126 	   111 	   103
	000063	   105 	   040 	   003
	000066	   040 	   116 	   117
	000071	   124 	   040 	   111
	000074	   116 	   040 	   123
	000077	   131 	   123 	   124
	000102	   105 	   115 	   005
	000105	   000
	001266	012746 	000055'			MOV	#$$$,-(SP)
	001272	004737 	002754'			JSR	PC,TYPMSG
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 8
DISPATCH TO ACTION ROUTINES

    328						.SBTTL	DISPATCH TO ACTION ROUTINES
    329					;
    330					; HERE WHEN DEVICES FOUND TO EXIST
    331					;
    332	001276				GOTDEV:
    333	001276					CLEF$S	#64.
	001276	012746 	000100 			MOV	#64.,-(SP)
	001302	012746 				MOV	(PC)+,-(SP)
	001304	   037 	   002 			.BYTE	31.,2
	001306	104375 				EMT	375
    334					;
    335	001310	013702 	000340'			MOV	BUFADR,R2
    336	001314	013703 	000326'			MOV	BUFSIZ,R3
    337					;
    338	001320	105737 	000032'			TSTB	HEFLAG		;/HE???
    339	001324	001405 				BEQ	GOTDV1		;NO-- GO ON
    340	001326					TYPE	^\COP> DEST-DEV: = SRC-DEV: /SW -- SWITCHES: /BL:N,N /CP /HE /RD /VF /ZE"<1>"\
	000106	   103 	   117 	   120 		.ASCIZ	"COP> DEST-DEV: = SRC-DEV: /SW -- SWITCHES: /BL:N,N /CP /HE /RD /VF /ZE"<1>""
	000111	   076 	   040 	   104
	000114	   105 	   123 	   124
	000117	   055 	   104 	   105
	000122	   126 	   072 	   040
	000125	   075 	   040 	   123
	000130	   122 	   103 	   055
	000133	   104 	   105 	   126
	000136	   072 	   040 	   057
	000141	   123 	   127 	   040
	000144	   055 	   055 	   040
	000147	   123 	   127 	   111
	000152	   124 	   103 	   110
	000155	   105 	   123 	   072
	000160	   040 	   057 	   102
	000163	   114 	   072 	   116
	000166	   054 	   116 	   040
	000171	   057 	   103 	   120
	000174	   040 	   057 	   110
	000177	   105 	   040 	   057
	000202	   122 	   104 	   040
	000205	   057 	   126 	   106
	000210	   040 	   057 	   132
	000213	   105 	   001 	   000
	001326	012746 	000106'			MOV	#$$$,-(SP)
	001332	004737 	002754'			JSR	PC,TYPMSG
    341	001336	000575 				BR	DONEA		;HELP IS ON THE WAY . . .
    342					;
    343	001340				GOTDV1:
    344	001340	005737 	000034'			TST	CPVFLG		;/CP OR /VF SPECIFIED?
    345	001344	001012 				BNE	COPVFY		;YES-- CHECK IT OUT
    346	001346	005737 	000036'			TST	RDZFLG		;/ZE OR /RD?
    347	001352	001003 				BNE	10$		;YES-- DO THEM
    348	001354	005737 	000024'			TST	DSTDEV		;NO SWITCHES-- DESTINATION SPEC?
    349	001360	001002 				BNE	20$		;YES-- MUST WANT COPY & VERIFY
    350	001362				10$:
    351	001362	000137 	002004'			JMP	RDZERO		;GO READ OR ZERO
    352					;
    353	001366				20$:
    354	001366	005137 	000034'			COM	CPVFLG		;OUTPUT SPEC-- ASSUME COPY & VERIFY
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 8-1
DISPATCH TO ACTION ROUTINES

    355					;	BR	COPVFY		;SO DO COPY
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 9
COPY, VERIFY, COPY & VERIFY (/CP, /VF, /CP/VF)

    357						.SBTTL	COPY, VERIFY, COPY & VERIFY (/CP, /VF, /CP/VF)
    358					;
    359					;
    360	001372				COPVFY:
    361	001372	005737 	000036'			TST	RDZFLG		;/RD OR /ZE?
    362	001376	001156 				BNE	CFMERR		;YES-- CONFLICTING SWITCHES
    363	001400	005737 	000014'			TST	SRCDEV		;INPUT NEEDED
    364	001404	001563 				BEQ	NISERR		; . .
    365	001406	005737 	000024'			TST	DSTDEV		;MAKE SURE OUTPUT
    366	001412	001554 				BEQ	NOSERR		;NO-- NEED OUTPUT
    367	001414	105737 	000034'			TSTB	CPFLAG		;/CP?
    368	001420	001430 				BEQ	VERIFY		;NO-- JUST DO VERIFY
    369					;
    370	001422				10$:	CALL	SRCRD
	001422	004737 	002174'			JSR	PC,SRCRD
    371	001426					CALL	DSTWT
	001426	004737 	002220'			JSR	PC,DSTWT
    372	001432	105737 	000030'			TSTB	EOVFLG
    373	001436	001771 				BEQ	10$
    374	001440	105737 	000035'			TSTB	VFFLAG		;/VF SPEC ALSO?
    375	001444	001532 				BEQ	DONEA
    376	001446					TYPE	<COP -- STARTING VERIFY"<1>">
	000216	   103 	   117 	   120 		.ASCIZ	"COP -- STARTING VERIFY"<1>""
	000221	   040 	   055 	   055
	000224	   040 	   123 	   124
	000227	   101 	   122 	   124
	000232	   111 	   116 	   107
	000235	   040 	   126 	   105
	000240	   122 	   111 	   106
	000243	   131 	   001 	   000
	001446	012746 	000216'			MOV	#$$$,-(SP)
	001452	004737 	002754'			JSR	PC,TYPMSG
    377	001456	005037 	000010'			CLR	SRCBLK
    378	001462	005037 	000012'			CLR	SRCBLK+2
    379	001466	005037 	000020'			CLR	DSTBLK
    380	001472	005037 	000022'			CLR	DSTBLK+2
    381	001476	105037 	000030'			CLRB	EOVFLG
    382					;	BR	VERIFY		;DO THE VERIFY
    383					;
    384					; VERIFY (/VF)
    385					;
    386	001502				VERIFY:
    387	001502	013703 	000332'			MOV	BUFSZ4,R3
    388					;
    389	001506				VFY1:	CALL	SRCRD
	001506	004737 	002174'			JSR	PC,SRCRD
    390	001512					PUSH	R2		;SAVE BUFFER ADDRESS
	001512	010246 				MOV	R2,-(SP)
    391	001514	060302 				ADD	R3,R2
    392	001516					CALL	DSTRD
	001516	004737 	002212'			JSR	PC,DSTRD
    393	001522	060302 				ADD	R3,R2		;BUMP TO NEXT BUFFER
    394	001524	105737 	000030'			TSTB	EOVFLG		;END-OF-VOLUME REACHED?
    395	001530	001017 				BNE	20$		;YES-- DON'T READ NEXT BUFFER AHEAD
    396	001532	020237 	000336'			CMP	R2,BUFEND	;AT END?
    397	001536	103402 				BLO	10$		;NO-- GO ON
    398	001540	013702 	000340'			MOV	BUFADR,R2	;YES-- RECYCLE
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 9-1
COPY, VERIFY, COPY & VERIFY (/CP, /VF, /CP/VF)

    399	001544				10$:
    400	001544	105237 	000017'			INCB	SRCNBF		;DON'T BLOCK
    401	001550					CALL	SRCRD		;START READ OF NEXT BLOCK
	001550	004737 	002174'			JSR	PC,SRCRD
    402	001554	060302 				ADD	R3,R2		;BUMP TO NEXT BUFFER (DEST)
    403	001556	105237 	000027'			INCB	DSTNBF		;DON'T BLOCK
    404	001562					CALL	DSTRD		;START READ OF NEXT BLOCK
	001562	004737 	002212'			JSR	PC,DSTRD
    405	001566	160302 				SUB	R3,R2		;BACK DO BUFFER START
    406	001570				20$:
    407	001570					POP	R1		;RESTORE CURRENT BUFFER ADDRESS
	001570	012601 				MOV	(SP)+,R1
    408	001572					PUSH	R2		;SAVE NEXT ONE
	001572	010246 				MOV	R2,-(SP)
    409	001574	010102 				MOV	R1,R2		;COPY ADDRESS
    410	001576	060302 				ADD	R3,R2		;MAKE THAT DEST BUFFER ADDRESS
    411	001600	010204 				MOV	R2,R4		;COPY THAT FOR TERMINATION
    412	001602	010100 				MOV	R1,R0		;COPY INIT ADDRESS IN CASE OF ERROR
    413	001604				VFY2:
    414	001604	022122 				CMP	(R1)+,(R2)+	;MATCH?
    415	001606	001443 				BEQ	VFY3		;YES-- OK
    416	001610	005741 				TST	-(R1)		;NO-- VERIFY ERROR-- GET US BACK INTO THE BLOCK WITH THE ERROR
    417	001612	160001 				SUB	R0,R1		;COMPUTE BYTES INTO BUFFER
    418	001614	010146 				MOV	R1,-(SP)	;COPY THAT COUNT
    419	001616	062701 	001000 			ADD	#1000,R1	;ROUND UP
    420	001622	042701 	000777 			BIC	#1000-1,R1	; TO NEXT BLOCK
    421	001626	060001 				ADD	R0,R1		;THEN TO BUFFER ADDRESS OF SAME
    422	001630	010102 				MOV	R1,R2		;COPY ADDRESS
    423	001632	063702 	000332'			ADD	BUFSZ4,R2	;MAKE THAT INTO DESTINATION BUFFER
    424	001636	105016 				CLRB	(SP)		;ZERO THE UNUSED BITS
    425	001640	000316 				SWAB	(SP)		;MAKE THAT BYTES/400
    426	001642	006216 				ASR	(SP)		; BYTES/1000 =BLOCKS
    427	001644	063716 	000012'			ADD	SRCBLK+2,(SP)	;COMPUTE BLOCK IN ERROR
    428	001650	013746 	000010'			MOV	SRCBLK+0,-(SP)	; . .
    429	001654	005516 				ADC	(SP)		; YOU TOO
    430	001656	163766 	000334'	000002 		SUB	BUFBL4,2(SP)	;DOWN BY A BUFFER-SIZE OF BLOCKS
    431	001664	005616 				SBC	(SP)		;YOU TOO
    432	001666	010605 				MOV	SP,R5		;THAT'S WHERE OUR BLOCK # IS
    433	001670	062705 	000004 			ADD	#SRCDEV-SRCBLK,R5 ;POINT TO RIGHT PLACE
    434	001674					WARN	<VERIFY ERROR"<10>">
	000246	   012 	   126 	   105 		.ASCIZ	""<12>"VERIFY ERROR"<10>""<1>""
	000251	   122 	   111 	   106
	000254	   131 	   040 	   105
	000257	   122 	   122 	   117
	000262	   122 	   010 	   001
	000265	   000
	001674	012746 	000246'			MOV	#$$$,-(SP)
	001700	004737 	002754'			JSR	PC,TYPMSG
    435	001704	162705 	000004 			SUB	#SRCDEV-SRCBLK,R5 ;BACK AGAIN FOR CTCCHK
    436	001710					CALL	CTCCHK		;CHECK FOR ^C JUST IN CASE NOW
	001710	004737 	002112'			JSR	PC,CTCCHK
    437	001714	022626 				CMP	(SP)+,(SP)+	;PHEW!
    438	001716				VFY3:
    439	001716	020104 				CMP	R1,R4		;DONE YET?
    440	001720	103731 				BLO	VFY2		;NO-- BACK FOR ANOTHER WORD
    441	001722					POP	R2		;RESTORE NEXT BUFFER ADDRESS
	001722	012602 				MOV	(SP)+,R2
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 9-2
COPY, VERIFY, COPY & VERIFY (/CP, /VF, /CP/VF)

    442	001724	105737 	000030'			TSTB	EOVFLG		;YES-- DONE WITH VOLUME YET?
    443	001730	001666 				BEQ	VFY1		;NO-- KEEP ON READING
    444	001732				DONEA:
    445	001732	000507 				BR	DONE		;YES-- ALL DONE WITH VERIFY
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 10
SPECIFICATION ERRORS

    447						.SBTTL	SPECIFICATION ERRORS
    448					;
    449					;
    450	001734				CFMERR:
    451	001734					ERROR	<CONFLICTING SWITCHES>
	000266	   011 	   103 	   117 		.ASCIZ	""<11>"CONFLICTING SWITCHES"<5>""
	000271	   116 	   106 	   114
	000274	   111 	   103 	   124
	000277	   111 	   116 	   107
	000302	   040 	   123 	   127
	000305	   111 	   124 	   103
	000310	   110 	   105 	   123
	000313	   005 	   000
	001734	012746 	000266'			MOV	#$$$,-(SP)
	001740	004737 	002754'			JSR	PC,TYPMSG
    452	001744				NOSERR:
    453	001744					ERROR	<NO DESTINATION DEVICE SPECIFIED FOR /CP OR /VF OR /ZE>
	000315	   011 	   116 	   117 		.ASCIZ	""<11>"NO DESTINATION DEVICE SPECIFIED FOR /CP OR /VF OR /ZE"<5>""
	000320	   040 	   104 	   105
	000323	   123 	   124 	   111
	000326	   116 	   101 	   124
	000331	   111 	   117 	   116
	000334	   040 	   104 	   105
	000337	   126 	   111 	   103
	000342	   105 	   040 	   123
	000345	   120 	   105 	   103
	000350	   111 	   106 	   111
	000353	   105 	   104 	   040
	000356	   106 	   117 	   122
	000361	   040 	   057 	   103
	000364	   120 	   040 	   117
	000367	   122 	   040 	   057
	000372	   126 	   106 	   040
	000375	   117 	   122 	   040
	000400	   057 	   132 	   105
	000403	   005 	   000
	001744	012746 	000315'			MOV	#$$$,-(SP)
	001750	004737 	002754'			JSR	PC,TYPMSG
    454	001754				NISERR:
    455	001754					ERROR	<NO SOURCE DEVICE SPECIFIED FOR /CP OR /VF OR /RD>
	000405	   011 	   116 	   117 		.ASCIZ	""<11>"NO SOURCE DEVICE SPECIFIED FOR /CP OR /VF OR /RD"<5>""
	000410	   040 	   123 	   117
	000413	   125 	   122 	   103
	000416	   105 	   040 	   104
	000421	   105 	   126 	   111
	000424	   103 	   105 	   040
	000427	   123 	   120 	   105
	000432	   103 	   111 	   106
	000435	   111 	   105 	   104
	000440	   040 	   106 	   117
	000443	   122 	   040 	   057
	000446	   103 	   120 	   040
	000451	   117 	   122 	   040
	000454	   057 	   126 	   106
	000457	   040 	   117 	   122
	000462	   040 	   057 	   122
	000465	   104 	   005 	   000
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 10-1
SPECIFICATION ERRORS

	001754	012746 	000405'			MOV	#$$$,-(SP)
	001760	004737 	002754'			JSR	PC,TYPMSG
    456	001764				TMSERR:
    457	001764					ERROR	<SOURCE DEVICE SPECIFIED FOR /ZE>
	000470	   011 	   123 	   117 		.ASCIZ	""<11>"SOURCE DEVICE SPECIFIED FOR /ZE"<5>""
	000473	   125 	   122 	   103
	000476	   105 	   040 	   104
	000501	   105 	   126 	   111
	000504	   103 	   105 	   040
	000507	   123 	   120 	   105
	000512	   103 	   111 	   106
	000515	   111 	   105 	   104
	000520	   040 	   106 	   117
	000523	   122 	   040 	   057
	000526	   132 	   105 	   005
	000531	   000
	001764	012746 	000470'			MOV	#$$$,-(SP)
	001770	004737 	002754'			JSR	PC,TYPMSG
    458	001774				TMDERR:
    459	001774					ERROR	<DESTINATION DEVICE SPECIFIED FOR /RD>
	000532	   011 	   104 	   105 		.ASCIZ	""<11>"DESTINATION DEVICE SPECIFIED FOR /RD"<5>""
	000535	   123 	   124 	   111
	000540	   116 	   101 	   124
	000543	   111 	   117 	   116
	000546	   040 	   104 	   105
	000551	   126 	   111 	   103
	000554	   105 	   040 	   123
	000557	   120 	   105 	   103
	000562	   111 	   106 	   111
	000565	   105 	   104 	   040
	000570	   106 	   117 	   122
	000573	   040 	   057 	   122
	000576	   104 	   005 	   000
	001774	012746 	000532'			MOV	#$$$,-(SP)
	002000	004737 	002754'			JSR	PC,TYPMSG
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 11
READ, ZERO (/RD, /ZE)

    461						.SBTTL	READ, ZERO (/RD, /ZE)
    462					;
    463					;
    464	002004				RDZERO:
    465	002004	105737 	000037'			TSTB	ZEFLAG		;ZERO?
    466	002010	001424 				BEQ	READ		;NO-- TRY FOR READ
    467					;	BR	ZERO		;YES-- ZERO
    468					;
    469					; ZERO (/ZE)
    470					;
    471	002012				ZERO:
    472	002012	105737 	000036'			TSTB	RDFLAG		;/RD????
    473	002016	001346 				BNE	CFMERR		;YES-- CONFLICT
    474	002020	005737 	000024'			TST	DSTDEV		;OUTPUT SPEC?
    475	002024	001747 				BEQ	NOSERR		;NO-- WE NEED IT
    476	002026	005737 	000014'			TST	SRCDEV		;HOW 'BOUT INPUT?
    477	002032	001354 				BNE	TMSERR		;THAT'S NOT NEEDED
    478					;
    479	002034	010200 				MOV	R2,R0		;COPY BUFFER ADDRESS
    480	002036	013701 	000330'			MOV	BUFSZ2,R1	;GET BUFFER SIZE IN WORDS
    481	002042				10$:
    482	002042	005020 				CLR	(R0)+		;ZERO A WORD
    483	002044	077102 				SOB	R1,10$		;LOOP FOR WHOLE BUFFER
    484	002046				20$:
    485	002046					CALL	DSTWT		;WRITE A BUFFER OF ZEROS
	002046	004737 	002220'			JSR	PC,DSTWT
    486	002052	105737 	000030'			TSTB	EOVFLG		;DONE?
    487	002056	001773 				BEQ	20$		;NO-- KEEP ON WRITING
    488	002060	000434 				BR	DONE		;YES-- ALLL DONE
    489					;
    490					; READ (/RD)
    491					;
    492	002062				READ:
    493	002062	005737 	000024'			TST	DSTDEV		;DSTDEV SPEC??
    494	002066	001342 				BNE	TMDERR		;YES-- WE CAN'T USE IT
    495	002070	005737 	000014'			TST	SRCDEV		;INPUT SPEC?
    496	002074	001727 				BEQ	NISERR		;NO-- REQUIRED FOR /RD
    497					;
    498	002076				10$:	CALL	SRCRD
	002076	004737 	002174'			JSR	PC,SRCRD
    499	002102	105737 	000030'			TSTB	EOVFLG
    500	002106	001773 				BEQ	10$
    501	002110	000420 				BR	DONE
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 12
^C CHECK AND DONE

    503						.SBTTL	^C CHECK AND DONE
    504					;
    505					; CTCCHK -- CHECK FOR ^C TYPED
    506					;
    507	002112				CTCCHK:
    508	002112					CLEF$S	#64.
	002112	012746 	000100 			MOV	#64.,-(SP)
	002116	012746 				MOV	(PC)+,-(SP)
	002120	   037 	   002 			.BYTE	31.,2
	002122	104375 				EMT	375
    509	002124	023727 	000000G	000000G		CMP	@#$DSW,#IS.SET
    510	002132	001401 				BEQ	10$		;SET-- ABORT NOW
    511	002134					RETURN			;NOT SET-- RETURN FROM CTCCHK
	002134	000207 				RTS	PC
    512					;
    513	002136				10$:
    514	002136	062705 	000004 			ADD	#SRCDEV-SRCBLK,R5
    515	002142					WARN	<ABORTED BY ^C"<10>">
	000601	   012 	   101 	   102 		.ASCIZ	""<12>"ABORTED BY ^C"<10>""<1>""
	000604	   117 	   122 	   124
	000607	   105 	   104 	   040
	000612	   102 	   131 	   040
	000615	   136 	   103 	   010
	000620	   001 	   000
	002142	012746 	000601'			MOV	#$$$,-(SP)
	002146	004737 	002754'			JSR	PC,TYPMSG
    516					;	BR	DONE
    517					;
    518					; DONE -- HERE WHEN ALL DONE WITH COMMAND
    519					;
    520	002152				DONE:
    521	002152	013706 	000000'			MOV	SPSAVE,SP
    522	002156	105737 	000031'			TSTB	CTZFLG		;^Z TYPED?
    523	002162	001002 				BNE	10$		;YES-- GO AWAY
    524	002164	000137 	000342'			JMP	COPY
    525	002170				10$:
    526	002170	000137 	003406'			JMP	EXIT
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 13
I/O ROUTINES

    528						.SBTTL	I/O ROUTINES
    529					;
    530					; SRCRD -- READ FROM SRCLUN
    531					;
    532	002174				SRCRD:
    533	002174	012704 	000000G			MOV	#IO.RLB,R4
    534	002200	012701 	000002 			MOV	#SRCLUN,R1
    535	002204	012705 	000010'			MOV	#SRCBLK,R5
    536	002210	000411 				BR	DEVOP
    537					;
    538					; DSTRD -- READ FROM DSTLUN
    539					;
    540	002212				DSTRD:
    541	002212	012704 	000000G			MOV	#IO.RLB,R4
    542	002216	000402 				BR	DSTOP
    543					;
    544					; DSTWT -- WRITE TO DSTLUN
    545					;
    546	002220				DSTWT:
    547	002220	012704 	000000G			MOV	#IO.WLB,R4
    548	002224				DSTOP:
    549	002224	012701 	000003 			MOV	#DSTLUN,R1
    550	002230	012705 	000020'			MOV	#DSTBLK,R5
    551					;	BR	DEVOP
    552					;
    553					; DEVOP -- PERFORM I/O ON A DEV
    554					;	R1 -- LUN (ALSO EFN)
    555					;	R2 -- ADDR OF BUFFER
    556					;	R3 -- SIZE OF BUFFER
    557					;	R4 -- I/O FUNCTION
    558					;	R5 -- ADDR OF CURRENT BLOCK #
    559					;
    560					; RETURNS:
    561					;	EOVFLG -- NON-ZERO IF EOV ENCOUNTERED (ON ANY OPERATION)
    562					;
    563	002234				DEVOP:
    564	002234					PUSH	<R2,R3>
	002234	010246 				MOV	R2,-(SP)
	002236	010346 				MOV	R3,-(SP)
    565	002240	010200 				MOV	R2,R0
    566	002242	060300 				ADD	R3,R0
    567					;
    568	002244	105765 	000007 			TSTB	SRCNBF-SRCBLK(R5) ;NO BLOCK MODE?
    569	002250	002007 				BGE	DEVOP1		;NO, OR NOT TIME TO BLOCK-- GO ON
    570	002252	105065 	000007 			CLRB	SRCNBF-SRCBLK(R5) ;YES-- CLEAR FLAG
    571	002256					WTSE$S	R1		; AND BLOCK NOW
	002256	010146 				MOV	R1,-(SP)
	002260	012746 				MOV	(PC)+,-(SP)
	002262	   051 	   002 			.BYTE	41.,2
	002264	104375 				EMT	375
    572	002266	000451 				BR	DEVOP2		;ONWARD!
    573					;
    574	002270				DEVOP1:
    575	002270					CALL	CTCCHK		;CHECK FOR ^C
	002270	004737 	002112'			JSR	PC,CTCCHK
    576					;
    577	002274	105765 	000007 			TSTB	SRCNBF-SRCBLK(R5) ;NO BLOCK?
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 13-1
I/O ROUTINES

    578	002300	003424 				BLE	10$		;NO-- GO ON AND DO QIOW$
    579	002302	105465 	000007 			NEGB	SRCNBF-SRCBLK(R5) ;YES-- SET FLAG TO BLOCK NEXT CALL
    580	002306					QIO$S	R4,R1,R1,,#QIOSTS,,<R2,R3,,(R5),2(R5)>
	002306	016546 	000002 			MOV	2(R5),-(SP)
	002312	011546 				MOV	(R5),-(SP)
	002314	005046 				CLR	-(SP)
	002316	010346 				MOV	R3,-(SP)
	002320	010246 				MOV	R2,-(SP)
	002322	005046 				CLR	-(SP)
	002324	012746 	000004'			MOV	#QIOSTS,-(SP)
	002330	005046 				CLR	-(SP)
	002332	110116 				MOVB	R1,(SP)
	002334	010146 				MOV	R1,-(SP)
	002336	010446 				MOV	R4,-(SP)
	002340	012746 				MOV	(PC)+,-(SP)
	002342	   001 	   013 			.BYTE	1,$$$T1
	002344	104375 				EMT	375
    581	002346	103500 				BCS	FTLERR		;OOPS!!!
    582	002350	000474 				BR	DEVOP9		;GO NOW, RETURN LATER TO COMPLETE WAIT
    583					;
    584	002352				10$:
    585	002352					QIOW$S	R4,R1,R1,,#QIOSTS,,<R2,R3,,(R5),2(R5)>
	002352	016546 	000002 			MOV	2(R5),-(SP)
	002356	011546 				MOV	(R5),-(SP)
	002360	005046 				CLR	-(SP)
	002362	010346 				MOV	R3,-(SP)
	002364	010246 				MOV	R2,-(SP)
	002366	005046 				CLR	-(SP)
	002370	012746 	000004'			MOV	#QIOSTS,-(SP)
	002374	005046 				CLR	-(SP)
	002376	110116 				MOVB	R1,(SP)
	002400	010146 				MOV	R1,-(SP)
	002402	010446 				MOV	R4,-(SP)
	002404	012746 				MOV	(PC)+,-(SP)
	002406	   003 	   013 			.BYTE	3,$$$T1
	002410	104375 				EMT	375
    586	002412				DEVOP2:
    587	002412	103456 				BCS	FTLERR
    588	002414	123727 	000004'	000000G		CMPB	QIOSTS+0,#IE.BLK
    589	002422	001411 				BEQ	20$
    590					;
    591	002424	020327 	001000 			CMP	R3,#1000
    592	002430	003416 				BLE	40$
    593					;
    594	002432	105737 	000004'			TSTB	QIOSTS+0
    595	002436	003005 				BGT	30$
    596	002440	012703 	001000 			MOV	#1000,R3
    597	002444	000711 				BR	DEVOP1
    598					;
    599	002446	105237 	000030'		20$:	INCB	EOVFLG
    600					;
    601	002452	000303 			30$:	SWAB	R3
    602	002454	006203 				ASR	R3
    603	002456	060365 	000002 			ADD	R3,2(R5)
    604	002462	105515 				ADCB	(R5)
    605	002464	000426 				BR	DEVOP9
    606					;
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 13-2
I/O ROUTINES

    607	002466	105737 	000004'		40$:	TSTB	QIOSTS+0
    608	002472	003014 				BGT	DEVOP8
    609					;
    610	002474	123727 	000004'	000000G	50$:	CMPB	QIOSTS+0,#IE.VER
    611	002502	001022 				BNE	FTLERR
    612	002504					PUSH	R5
	002504	010546 				MOV	R5,-(SP)
    613	002506	062705 	000004 			ADD	#SRCDEV-SRCBLK,R5
    614	002512					WARN	<I/O ERROR ON "<3><10>">
	000622	   012 	   111 	   057 		.ASCIZ	""<12>"I/O ERROR ON "<3><10>""<1>""
	000625	   117 	   040 	   105
	000630	   122 	   122 	   117
	000633	   122 	   040 	   117
	000636	   116 	   040 	   003
	000641	   010 	   001 	   000
	002512	012746 	000622'			MOV	#$$$,-(SP)
	002516	004737 	002754'			JSR	PC,TYPMSG
    615	002522					POP	R5
	002522	012605 				MOV	(SP)+,R5
    616					;
    617	002524	060302 			DEVOP8:	ADD	R3,R2
    618	002526	062765 	000001 	000002 		ADD	#1,2(R5)
    619	002534	105515 				ADCB	(R5)
    620	002536	020200 				CMP	R2,R0
    621	002540	103653 				BLO	DEVOP1
    622					;
    623	002542				DEVOP9:
    624	002542					POP	<R3,R2>
	002542	012603 				MOV	(SP)+,R3
	002544	012602 				MOV	(SP)+,R2
    625	002546					RETURN
	002546	000207 				RTS	PC
    626					;
    627	002550				FTLERR:
    628	002550	013706 	000000'			MOV	SPSAVE,SP
    629	002554	113700 	000004'			MOVB	QIOSTS+0,R0
    630	002560	001404 				BEQ	10$
    631	002562	120027 	000000G			CMPB	R0,#IE.WLK	;WRITE-LOCK?
    632	002566	001411 				BEQ	WLKERR		;YES-- SAY THAT
    633	002570	000402 				BR	20$		;NO-- GO ON
    634					;
    635	002572				10$:
    636	002572	013700 	000000G			MOV	@#$DSW,R0
    637	002576				20$:
    638	002576	062705 	000004 			ADD	#SRCDEV-SRCBLK,R5
    639	002602					ERROR	<FATAL I/O ERROR "<7>" ON "<3><10>">
	000644	   011 	   106 	   101 		.ASCIZ	""<11>"FATAL I/O ERROR "<7>" ON "<3><10>""<5>""
	000647	   124 	   101 	   114
	000652	   040 	   111 	   057
	000655	   117 	   040 	   105
	000660	   122 	   122 	   117
	000663	   122 	   040 	   007
	000666	   040 	   117 	   116
	000671	   040 	   003 	   010
	000674	   005 	   000
	002602	012746 	000644'			MOV	#$$$,-(SP)
	002606	004737 	002754'			JSR	PC,TYPMSG
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 13-3
I/O ROUTINES

    640	002612				WLKERR:
    641	002612					ERROR	<DEVICE "<3>" IS WRITE-LOCKED>
	000676	   011 	   104 	   105 		.ASCIZ	""<11>"DEVICE "<3>" IS WRITE-LOCKED"<5>""
	000701	   126 	   111 	   103
	000704	   105 	   040 	   003
	000707	   040 	   111 	   123
	000712	   040 	   127 	   122
	000715	   111 	   124 	   105
	000720	   055 	   114 	   117
	000723	   103 	   113 	   105
	000726	   104 	   005 	   000
	002612	012746 	000676'			MOV	#$$$,-(SP)
	002616	004737 	002754'			JSR	PC,TYPMSG
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 14
COMMAND PARSER ROUTINES

    643						.SBTTL	COMMAND PARSER ROUTINES
    644					;
    645					; GENERAL NOTES:
    646					;
    647					; R4 IS ALWAYS USED AS A POINTER TO THE COMMAND STRING.  ON CALL,
    648					; IT POINTS TO THE NEXT CHARACTER TO BE PROCESSED.  ON RETURN, R4
    649					; ALWAYS POINTS TO THE CHARACTER AFTER THE LAST ONE PROCESSED, I.E.
    650					; THE NEXT ONE TO BE PROCESSED.
    651					;
    652					; NOTE THAT END-OF-LINE IS A ZERO BYTE
    653					;
    654					;
    655					; GETNB -- GET NEXT NON-BLANK CHARACTER
    656					;
    657					; RETURNS WITH R4 POINTING TO THE NEXT NON-BLANK CHARACTER
    658					;	R0 --	NON-BLANK CHARACTER
    659					;	CC-Z SET IF END-OF-LINE
    660					;
    661	002622				GETNB:
    662	002622	112400 				MOVB	(R4)+,R0	;GET A CHARACTER
    663	002624	122700 	000040 			CMPB	#' ,R0		;THIS BLANK?
    664	002630	001774 				BEQ	GETNB		;YES-- LOOK SOME MORE
    665	002632	122700 	000011 			CMPB	#'	,R0	;OR A TAB?
    666	002636	001771 				BEQ	GETNB		;YES-- LOOK SOME MORE
    667	002640				10$:
    668	002640	105744 				TSTB	-(R4)		;NON-BLANK-- BACK OVER IT (MAY BE EOL)
    669	002642					RETURN			; FROM GETNB
	002642	000207 				RTS	PC
    670					;
    671					; GETNAM -- GET TWO-CHARACTER ALPHABETIC NAME
    672					;
    673					; RETURNS AFTER TWO CHARCTERS OR NON-ALPHABETIC
    674					;	R0 --	(LOW) FIRST CHARACTER (HIGH) SECOND CHARACTER
    675					;	CC-C SET IF MORE THAN TWO CHARACTERS
    676					;
    677	002644				GETNAM:
    678	002644	005000 				CLR	R0		;CLEAR ANSWER
    679	002646				10$:
    680	002646	122714 	000101 			CMPB	#'A,(R4)	;BELOW A?
    681	002652	101015 				BHI	50$		;YES-- RETURN CC-C CLEAR
    682	002654	121427 	000132 			CMPB	(R4),#'Z	;OR ABOVE Z?
    683	002660	101012 				BHI	50$		;YES-- RETURN CC-C CLEAR
    684	002662	005700 				TST	R0		;GOT A BYTE YET?
    685	002664	001002 				BNE	20$		;YES-- STORE SECOND BYTE
    686	002666	112400 				MOVB	(R4)+,R0	;NO-- GET LOW BYTE
    687	002670	000766 				BR	10$		;LOOP FOR NEXT CHARACTER
    688					;
    689	002672				20$:
    690	002672	000300 				SWAB	R0		;GET HIGH BYTE
    691	002674	001003 				BNE	40$		;ALREADY THERE-- ERROR
    692	002676	152400 				BISB	(R4)+,R0	;OK-- SET SECOND CHARACTER
    693	002700	000300 				SWAB	R0		;RESTORE R0 TO PROPER ORIENTATION
    694	002702	000761 				BR	10$		;LOOP FOR ANOTHER (?)
    695					;
    696	002704				40$:
    697	002704	000261 				SEC			;ERROR
    698	002706				50$:
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 14-1
COMMAND PARSER ROUTINES

    699	002706					RETURN			; FROM GETNAM
	002706	000207 				RTS	PC
    700					;
    701					; GETNUM -- GET OCTAL NUMBER
    702					;
    703					; RETURNS WITH NON-DIGIT OR IF MORE THAN A WORD'S WORTH
    704					;	R0 --	NUMBER
    705					;	CC-C SET IF LARGER THAN ONE WORD
    706					;
    707	002710				GETNUM:
    708	002710	005000 				CLR	R0		;CLEAR RESULT
    709	002712				10$:
    710	002712	112401 				MOVB	(R4)+,R1	;GET A DIGIT
    711	002714	162701 	000060 			SUB	#'0,R1		;TRIM DOWN TO DIGIT
    712	002720	103413 				BLO	40$		;NOT A DIGIT-- GIVE UP
    713	002722	022701 	000007 			CMP	#7,R1		;TOO HIGH?
    714	002726	103410 				BLO	40$		;YES-- GIVE UP WITH CC-C CLEAR
    715		000003 			.REPT 3
    716						ASL	R0		;SHIFT OLD NUMBER A BIT
    717						BCS	50$		;CARRY OUT-- NUMBER TOO BIG-- CC-C SET
    718					.ENDR
	002730	006300 				ASL	R0		;SHIFT OLD NUMBER A BIT
	002732	103407 				BCS	50$		;CARRY OUT-- NUMBER TOO BIG-- CC-C SET
	002734	006300 				ASL	R0		;SHIFT OLD NUMBER A BIT
	002736	103405 				BCS	50$		;CARRY OUT-- NUMBER TOO BIG-- CC-C SET
	002740	006300 				ASL	R0		;SHIFT OLD NUMBER A BIT
	002742	103403 				BCS	50$		;CARRY OUT-- NUMBER TOO BIG-- CC-C SET
    719	002744	060100 				ADD	R1,R0		;ACCUMULATE THIS DIGIT
    720	002746	000761 				BR	10$		;FETCH ANOTHER DIGIT
    721					;
    722	002750				40$:
    723	002750	105744 				TSTB	-(R4)		;BACK OVER BAD CHARACTER
    724	002752				50$:
    725	002752					RETURN			;FROM GETNUM
	002752	000207 				RTS	PC
COPY -- MCR FUNCTION 'COP' FOR 	MACRO M1108  16-JAN-78 19:45  PAGE 15
TYPEOUT ROUTINES

    727						.SBTTL	TYPEOUT ROUTINES
    728					;
    729					; TYPMSG -- TYPE A RANDOM ASCIZ STRING
    730					;
    731					; CALL:
    732					;	PUSH	#<ADDRESS OF ASCIZ STRING>
    733					;	CALL	TYPMSG
    734					;
    735					; SPECIAL CHARACTER CODES IN TEXT:
    736					;	0 --	END OF TEXT
    737					;	1 --	TYPE <CR><LF>
    738					;	2 --	TYPE TWO CHARACTERS FROM R0 (SAVED ON STACK)
    739					;	3 --	TYPE DEVICE NAME AND UNIT FROM PUD ENTRY (R5)
    740					;	4 --	TYPE ASCIZ STRING BY R0
    741					;	5 --	TYPE <CR><LF> AND RETURN TO COPY
    742					;	6 --	OCTAL NUMBER IN R0 (SAVED ON STACK)
    743					;	7 --	DECIMAL NUMBER IN R0 (SAVED ON STACK)
    744					;	10 --	BLOCK # AT SRCBLK-SRCDEV(R5)
    745					;	11 --	FATAL ERROR PREFIX
    746					;	12 --	WARNING ERROR PREFIX
    747					;
    748	002754				TYPMSG:
    749	002754					PUSH	<R3,R2,R1,R0> ;COPY USED REGISTERS
	002754	010346 				MOV	R3,-(SP)
	002756	010246 				MOV	R2,-(SP)
	002760	010146 				MOV	R1,-(SP)
	002762	010046 				MOV	R0,-(SP)
    750	002764	016600 	000012 			MOV	12(SP),R0	;GET ADDRESS OF STRING
    751	002770	012702 	000040'			MOV	#TYPBUF,R2	;POINT TO OUTPUT BUFFER
    752					;
    753					; ENTER HERE AT TYPMS1:
    754					;	R0 --	POINTER TO STRING TO BE OUTPUT (AND FOLLOWING CODE)
    755					;	R2 --	CURRENT POINTER TO OUTPUT BUFFER FOR LOADING CHARACTERS
    756					;
    757	002774				TYPMS1:
    758	002774	112012 				MOVB	(R0)+,(R2)	;GET A CHARACTER FROM STRING
    759	002776	122227 	000013 			CMPB	(R2)+,#TYPMAX	;SPECIAL CODE?
    760	003002	103374 				BHIS	TYPMS1		;NO-- JUST GET NEXT CHARACTER
    761	003004	114203 				MOVB	-(R2),R3	;YES-- GET THE CODE
    762	003006	006303 				ASL	R3		;MAKE IT WORDS
    763	003010	011601 				MOV	(SP),R1		;GET R0 FROM STACK BACK TO R1
    764	003012					CALL	@TYPTAB(R3)	;CALL ROUTINE TO PROCESS
	003012	004773 	003020'			JSR	PC,@TYPTAB(R3)
    765	003016	000766 				BR	TYPMS1		;BACK FOR MO