Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - utilities/tenex-srccom.fai
There are no other files named tenex-srccom.fai in the archive.
00099	;<B.BLOHM>SRCCOM.FAI.2, 18-Nov-78 16:31:49, Edit by B.BLOHM
00100	; Fix to allow continuation of srccom.
00200	;<J.JQJOHNSON>SRCCOM.FAI.0, 30-Aug-78 16:28:01, Edit by J.JQJOHNSON
00300	; Failized it, and fixed GETDNM to handle CR properly
00400	;<BLOHM>SRCCOM.MAC;1	2-Aug-78 15:23:04	EDIT BY BLOHM
00500	; Converted input to use the PMAP jsys
00600	;<BLOHM>SRCCOM.MAC;1       24-JUL-78 12:00:00    EDIT BY BLOHM
00700	; ADDED SOS LINE NUMBER SWITCH (X FOR FUN),CHANGED INPUT TO 36 BIT
00800	; BYTES INSTEAD OF 7 BIT BYTES.
00900	;<HEDBERG> :
01000	; COMMENTED OUT SEARCH CPUNUM, SET VALUES FOR KA10F AND KL10F
01100	;<SOURCES>SRCCOM.MAC;18     5-Oct-76 23:21:49    EDIT BY TOMLINSON
01200	; FIX UP OUTPUTTING SWITHCES TO RECORDOFLISTINGS FILE
01300	;<SOURCES>SRCCOM.MAC;17    29-Sep-76 08:27:36    EDIT BY TOMLINSON
01400	; CHANGE L SWITCH TO B, MAKE L BE SET LINE T COMPARE FOR MATCH
01500	;<SOURCES>SRCCOM.MAC;16    27-Sep-76 12:31:05    EDIT BY TOMLINSON
01600	; ADDED W SWITCH, ELIMINATED QUESTION ABOUT CHANGED PAGES
01700	;<SOURCES>SRCCOM.MAC;15    25-Sep-76 09:25:39    EDIT BY TOMLINSON
01800	; N switch.  Switches in RECORDOFLISTINGS.
01900	; Changed page summary onto result of using RECORDOFLISTINGS
02000	; shortened changed page summary (1, 2, 4..7 ...)
02100	;<SOURCES-MODIFIED-FOR-THE-KL-20>SRCCOM.MAC.2    22-Sep-76 11:13:47    EDIT BY TOMLINSON
02200	; INSTALL KL20 ADAPTATIONS
02300	;<SOURCES>SRCCOM.MAC;13    25-SEP-75 13:14:38    EDIT BY TOMLINSON
02400	;<TOMLINSON>SRCCOM.MAC;2    25-SEP-75 11:33:16    EDIT BY TOMLINSON
02500	; FIX UP USER INTERFACE FOR EXCESSIVELY LONG CHANGES
02600	; PARAMETERIZED BUFFER LOCATIONS
02700	;<TOMLINSON>SRCCOM.MAC;6    20-JUN-75 07:53:44    EDIT BY TOMLINSON
02800	; DON'T COUNT DOWN FDBUSE FOR SPECIAL VERSIONS (0, -2 ETC)
02900	; ADDED MULTIPLE RECORDOFLISTINGS FEATURES
03000	;<SOURCES>SRCCOM.MAC;9    10-JUN-75 08:23:26    EDIT BY TOMLINSON
03100	; FIX BUG IN VERSION FIXUP CODE
03200	;<SOURCES>SRCCOM.MAC;8    10-JUN-75 07:51:02    EDIT BY TOMLINSON
03300	; added switches to ignore line-spacing, spacing, comments
03400	; and paging differences.
03500	;<SOURCES>SRCCOM.MAC;7    21-APR-75 13:13:36    EDIT BY TOMLINSON
03600	; Set FDBUND (perpetual) for files in RECORDOFLISTINGS
03700	;<SOURCES>SRCCOM.MAC;6     7-FEB-75 21:23:22    EDIT BY TOMLINSON
03800	; ASK ABOUT DIFFERENCES IN RECORDOFLISTINGS MODE
03900	; REMOVE SPURIOUS FF'S
04000	; USE ESOUT AFTER ERRORS
04100	; ELIMINATE SPURIOUS HEADING AT END OF LISTING
04200	; SUPPLY FORMFEED AFTER LAST PAGE IF NEEDED
04300	;<CALVIN>SRCCOM.MAC;3    26-JUL-74 12:05:58    EDIT BY CALVIN
04400	; MAKE SURE LAST PAGE GETS OUT IN CHANGE PGS ONLY
04500	;<CALVIN>SRCCOM.MAC;15    25-JUL-74 12:35:25    EDIT BY CALVIN
04600	; CHANGE TO MAKE SURE BUFFER AT 10000 DOESN'T OVERRUN
04700	;<CALVIN>SRCCOM.MAC;3    23-JUL-74 15:13:58    EDIT BY CALVIN
04800	; ADDED NEW "F" OPTION TO RECORDOFLISTINGS CODE, ALSO NOTES FILES
04900	; THAT ARE NOT FOUND IN RECORDOFLISTING MODE.
05000	;<133-TENEX>SRCCOM.MAC;1    20-JUL-74 13:12:57    EDIT BY ALLEN
05100	; ADD SYMBOL (NDPL) FOR PDL SIZE AND INCREASE FROM 60 TO 200
05200	;<SOURCES>SRCCOM.MAC;1    12-APR-74 16:14:29	EDIT BY CLEMENTS
05300	; CONVERTED TO MACRO SOURCE
05400	; PUT CR-LF'S IN PLACE OF EOL'S
05500	;<SOURCES>SRCCOM.FAI;12    26-DEC-73 22:29:38	EDIT BY PLUMMER
     
00100	
00200		TITLE	SRCCOM
00300		SUBTTL	R.S.TOMLINSON 28 JUNE 70
00400	;;ELH	SEARCH CPUNUM
00500	KA10F==0			;HEHE
00600	KL20F==1
00700	IFN KA10F,<SEARCH STENEX>
00800	IFN KL20F,<SEARCH MONSYM>
00900	
01000	ENTVEC:	JRST START
01100	
01200	MAXSWB==20
01300	NRECF==170
01400	NPDL=200	;PDL SIZE
01500	MAPPAG==17
01600	CPLBUF=20000
01700	PAGBUF=24000
01800	NPGBF==10000
01900	IBUF1==PAGBUF+NPGBF
02000	IBUF2==<777777-IBUF1>/2 + IBUF1
02100	
02200	OPDEF	CALL	[PUSHJ 17,]
02300	OPDEF	RET	[POPJ 17,]
02400	
02500	UUON==1		; OPCODE OF FIRST USER UUO
02600	ifdef for,<			;;fail assembly
02700	DEFINE	UUO ' (NAME)<
02800		Q'NAME
02900	OPDEF	NAME [<UUON>*1B8]
03000	UUON==UUON+1
03100	>>;fail
03200	ifndef for,<			;;macro assembly
03300	DEFINE	UUO (NAME)<
03400		EXP Q'NAME
03500	OPDEF	NAME [<UUON>*1B8]
03600	UUON==UUON+1
03700	>>;macro
03800	
03900	IRMRGN==^D71
04000	
04100	F=0
04200	A=1
04300	B=2
04400	CH=3
04500	PT1=4
04600	PT2=5
04700	X=6
04800	D=7
04900	HGH1=10
05000	HGH2=11
05100	SCN1=12
05200	SCN2=13
05300	C=14
05400	CNT=15
05500	P=17
05600	
05700	I1==1
05800	I2==2
05900	O1==3
06000	O2==4
     
00100	
00200	; FLAG BITS IN RH F
00300	
00400	EOF1==400000
00500	EOF2==200000
00600	OPN1==100000
00700	OPN2==040000
00800	MRK==020000
00900	MSG==010000
01000	LSTF==004000
01100	APPEND==002000
01200	UCPTOO==001000
01300	FIXUP==400		; GUY WANTS TO PAUSE ON RECORDOFLISTINGS SCREWUPS
01400	NEDHDG==200		; NEED HEADING IN PAG BUFFER
01500	DIFFSF==100		; LIST DIFFERENCES IN RECORDOFLISTINGS
01600	SPC1==40		; SPACE SEEN IN CHARACTER COMPARE
01700	SPC2==20		; SPACE SEEN FOR FILE 2
01800	NBGL1==10		; NOT BEGINNING OF LINE FOR FILE 1
01900	NBGL2==4		; DITTO FOR FILE 2
02000	TMPF==1
02100	
02200	; LEFT HALF FLAGS
02300	
02400	IGC==400000		; IGNORE COMMENTS
02500	IGS==200000		; IGNORE SPACING DIFFERENCES
02600	IGB==100000		; IGNORE LINE SPACING DIFFERENCES
02700	IGP==040000		; IGNORE PAGINATION DIFFERENCES
02800	IGU==020000		; IGNORE CASE DIFFERENCES
02900	NOASK==10000		; DON'T ASK TO CONTINUE WITHH LONG CHANGE
03000	BRF==4000		; SAW SEQUENTIAL PAGES WITH CHANGES
03100	BRF2==2000		; SAW TWO OR MORE SEQUENTIAL PAGES WITH CHANGES
03200	QUIETF==1000		; DON'T PRINT CHANGED PAGE NUMBERS DURING RUN
03300	;;*
03400	IGL==400				;* Ignore SOS line numbers
03500	;;*	
03600	
03700	
03800	;;* DATA PAGES
03900	PAG1==25				;* PAGE 21 CONTAINS FIRST INPUT FILE PAGE
04000	PAG2==26				;* PAGE 21 CONTAINS SECOND INPUT FILE PAGE
04100	;;*
04200	
     
00100	
00200	; UUO'S
00300	
00400	UUO40:	PUSH P,CH
00500		PUSH P,1
00600		PUSH P,2
00700		PUSH P,3
00800		LDB 1,[POINT 9,40,8]
00900		SKIPN 1,UUOTAB(1)
01000		HALT
01100		MOVEM 1,UUODSP#
01200		MOVE 1,-2(P)
01300		PUSHJ P,@UUODSP
01400		POP P,3
01500		POP P,2
01600		POP P,1
01700		POP P,CH
01800		POPJ P,
01900	
02000	UUOTAB:	0
02100	UUO (TMSG)
02200	UUO (CHOUT)
02300	UUO (OUTC2)
02400	UUO (OUTC1)
02500	UUO (OUTM1)
02600	UUO (OUTM2)
02700	REPEAT 40-<.-UUOTAB>,<0>
02800	
02900	QTMSG:	HRRZ 1,PRIMRY
03000	OUTMSG:	HRRO 2,40
03100		MOVEI 3,0
03200		SOUT
03300		POPJ P,
03400	
03500	QCHOUT:	HRRZ 2,40
03600		HRRZ 1,PRIMRY
03700		BOUT
03800		POPJ P,
03900	
04000	QOUTC2:	HRRZ CH,40
04100	OUTC2X:	TRNN F,OPN2
04200		POPJ P,
04300		CAIE CH,37
04400		CAIN CH,12
04500		JRST [	AOS B,DFLINE
04600			CAIL B,^D55
04700			PUSHJ P,DFHDNG
04800			JRST .+1]
04900		MOVE B,CH
05000		MOVE A,DIFJFN
05100		BOUT
05200		POPJ P,
     
00100	
00200	QOUTC1:	TRNN F,OPN1
00300		POPJ P,
00400		HRRZ CH,40
00500		CAIE CH,37
00600		CAIN CH,15
00700		JRST [	SETZM CH2POS
00800			JRST OUTC1Z]
00900		CAIE CH,12
01000		CAIN CH,14
01100		JRST OUTC1Z
01200		CAIN CH,11
01300		JRST [	MOVEI B,10
01400			ADD B,CH2POS
01500			ANDCMI B,7
01600			MOVEM B,CH2POS
01700			JRST OUTC1Z]
01800		CAIGE CH,40
01900		JRST [	PUSH P,CH
02000			OUTC1 "^"
02100			POP P,CH
02200			TRO CH,100
02300			JRST .+1]
02400	OUTC1B:	AOS CH2POS
02500	OUTC1Z:	MOVE B,CH
02600		MOVE A,LSTJFN
02700		TLNE A,777777
02800		JRST [	IDPB B,LSTJFN
02900			POPJ P,]
03000		BOUT
03100		POPJ P,
03200	
03300	QOUTM1:	HRRZ A,40
03400		HRLI A,(<POINT 7,0>)
03500		ILDB CH,A
03600		JUMPE CH,CPOPJ
03700		OUTC1 (CH)
03800		JRST QOUTM1+2
03900	
04000	QOUTM2:	HRRZ A,40
04100		HRLI A,(<POINT 7,0>)
04200		ILDB CH,A
04300		JUMPE CH,CPOPJ
04400		OUTC2 (CH)
04500		JRST QOUTM2+2
     
00100	
00200	; MAIN PROGRAM
00300	
00400	START:	HRROI 1,[ASCIZ /SRCCOM 2.5 23 OCT 76
00500	/]
00600		PSOUT				;* Output Title
00700	;*
00900	START0:	RESET
01000		SETZM TIMFRK#
01100		SETZM BZERO
01200		MOVSI A,BZERO
01300		HRRI A,BZERO+1
01400		BLT A,EZERO-1		; CLEAR TEMPORARY STORAGE AREAS
01500		MOVE A,[PUSHJ P,UUO40]
01600		MOVEM A,41			;* Initialize for UUO handler
01700		MOVE A,[XWD 100,101]
01800		MOVEM A,PRIMRY#
01900		MOVNI 1,1
02000		CLOSF				;* Close ALL open files
02100		JFCL
02200		RLJFN				;* And release their JFN's
02300		JFCL
02400		MOVE P,[XWD -NPDL,PDL-1]	;* Set up stack pointer
02500		MOVEI 1,101
02600		RFCOC 			; GET THOSE COC'S
02700		TRZ 3,3B19		; CLEAR BITS FOR ESC
02800		SFCOC
02900		MOVEI A,4
03000		MOVEM A,NMATLN#
03100		MOVEI F,0
03200		MOVE A,[POINT 7,CPLBUF]
03300		MOVEM A,CPLPTR#
03400		MOVEM A,CPLPT0#
03500		ANDCM F,[IGB!IGC!IGP!IGS!IGU!NOASK,,DIFFSF!FIXUP]
03600		MOVSI A,100101
03700	IFN KA10F,<HRROI B,[ASCIZ /RECORDOFLISTINGS.*;0/]>
03800	IFN KL20F,<HRROI B,[ASCIZ/RECORDOFLISTINGS.*.0/]>
03900		GTJFN				;* Any existing RECORDOFLISTIGS file?
04000		JRST NOREC			;* No (usual case). Start main program
04100		HRRZM 1,RECJFN#
04200		TMSG [ASCIZ /
04300	Use RECORDOFLISTINGS? /]
04400		PBIN
04500		CAIE	A,"N"+40
04600		CAIN A,"N"
04700		JRST [	MOVE 1,RECJFN
04800			RLJFN
04900			JFCL
05000			JRST NOREC]
05100		CAIE A,"Y"
05200		CAIN	A,"Y"+40
05300		JRST	XL0
05400		CAIN 1,"?"
05500		 JRST [	HRROI 1,[ASCIZ /
05600	N: User specified files.
05700	Y: Use RECORDOFLISTINGS file./]
05800			PSOUT
05900			JRST START0]
06000		HRROI 1,[ASCIZ / Y,N or ? please.
06100	/]
06200		ESOUT
06300		JRST START0
     
00100	
00200	XL0:	HRRZ 1,RECJFN
00300		MOVE 2,[1,,2]
00400		MOVEI 3,3
00500		GTFDB
00600		TRNN 3,777777		; OTHER EXTENSIONS?
00700		 JRST UREC1		; NO
00800	XL05:	TMSG [ASCIZ /
00900	Which one?: /]
01000		MOVEI 1,RECJFT
01100		HRROI 2,[ASCIZ /RECORDOFLISTINGS./]
01200		GTJFN
01300		 JRST [	HRROI 1,[ASCIZ //]
01400			ESOUT
01500			JRST XL05]
01600		EXCH 1,RECJFN
01700		RLJFN
01800		 JFCL
01900	UREC1:	TMSG [ASCIZ /
02000	How many copies do you want? /]
02100		HLRZ 1,PRIMRY
02200		MOVEI 3,12
02300		NIN
02400	XL0ERR:	 JRST [	HRROI [ASCIZ //]
02500			ESOUT
02600			JRST XL0]
02700		MOVEM 2,NCOPY#
02800		BKJFN
02900		JRST XL1
03000		BIN
03100		CAIN 2,15
03200		 BIN				; EAT FOLLOWING LF
03300		CAIE 2,37
03400		CAIN 2,12
03500		 CAIA
03600		  JRST XL0ERR
03700	; ..
     
00100	
00200	; ..
00300	
00400	XL1:	MOVE 1,RECJFN
00500		MOVE 2,[XWD 70000,200000]
00600		OPENF
00700		JRST [	MOVE 1,RECJFN
00800			RLJFN
00900			JFCL
01000			JRST NOREC]
01100		SETZM RECSWB
01200		TRO F,OPN1!OPN2
01300		MOVSI X,-NRECF
01400		MOVE C,[POINT 7,RECFST]
01500	INIRCL:INIRC3:	MOVEM C,RECFPT(X)
01600	IFN KL20F,<SETZM FRST.>		; IF 1ST OR 2ND "."
01700		BIN
01800		CAIE 2,40
01900		CAIN 2,12
02000		JRST INIRC3
02100		JUMPE 2,INIRCD
02200		CAIE 2,15
02300		CAIN 2,37
02400		JRST INIRCD
02500		CAIE 2,"/"
02600		 JRST INIRC4
02700		HRROI 2,RECSWB
02800		MOVEI 3,MAXSWB
02900		MOVEI 4,12
03000		SIN
03100		MOVEI 3,0
03200		IDPB 3,2
03300		MOVE 1,[POINT 7,RECSWB]
03400		PUSHJ P,SETFSW
03500		MOVE C,RECFPT(X)
03600		MOVE 1,RECJFN
03700		JRST INIRCL
03800	
03900	INIRC1:	BIN
04000	INIRC4:
04100	IFN KA10F,<CAIN 2,";"
04200		 JRST INIRC2>
04300	IFN KL20F,<CAIN 2,"."
04400		 JRST	[
04500			SKIPE FRST.
04600			 JRST INIRC2
04700			SETOM FRST.
04800			JRST .+1]
04900	>; END IFN KL20F
05000		IDPB 2,C
05100		JRST INIRC1
05200	
05300	INIRC2:	MOVEI 3,12
05400		NIN
05500		JRST INIRCL
05600		HRROM 2,RECFVR(X)
05700		MOVEI B,0
05800		IDPB B,C
05900		AOBJN X,INIRC3
06000	INIRCD:	MOVN C,X
06100		HRLZM C,RECFCT
06200		CALL SETSWT
06300		SKIPL X,RECFCT
06400		JRST LSTNXT
     
00100	
00200	LSTLUP:	HRRZ 1,RECFVR(X)
00300		HRLI 1,100001
00400		MOVE 2,RECFPT(X)
00500		PUSH P,2
00600		PUSH P,1
00700		GTJFN
00800		JRST	NOTHER		; GO NOTE & CHECK
00900		MOVEM 1,IN2JFN
01000		POP P,1
01100		POP P,2
01200		HRRI 1,0
01300		GTJFN
01400		JRST LSTNXT
01500		MOVEM 1,IN1JFN
01600		MOVE 2,[XWD 1,7]
01700		MOVEI 3,3
01800		GTFDB		; GET VERSION NUMBER OF LATEST ONE
01900		HLRO 3,3
02000		CAMN 3,RECFVR(X)
02100		JRST LSTNXT
02200		HRLM 3,RECFVR(X)	; REMEMBER LATEST VERSION TOO
02300		MOVSS 1,RECFVR(X)
02400		TLNN 1,777777		; COMPARE AGAINST VERSION 0?
02500		 JRST LSTNXT		; NOTHING TO DO
02600		HRROI B,[ASCIZ /LISTING.;T/]
02700		MOVSI 1,1
02800		GTJFN
02900		HALTF
03000		MOVEM A,LSTJFN
03100		HRROI B,[ASCIZ /DIFFERENCES.;T/]
03200		MOVSI A,1
03300		GTJFN
03400		HALTF
03500		MOVEM 1,DIFJFN
03600		TRZ F,EOF1!EOF2!MRK!MSG!NEDHDG
03700		SETZM CH2POS
03800		SETZM CHANGE
03900		TMSG [ASCIZ /
04000	Listing: /]
04100		MOVEI 1,101
04200		MOVE 2,IN1JFN
04300		MOVEI 3,0
04400		JFNS
04500		TMSG [ASCIZ / & /]
04600		MOVE 2,IN2JFN
04700		JFNS
04800		PUSH P,X
04900		PUSHJ P,STRT2
05000		TRO F,LSTF!APPEND
05100		POP P,X
     
00100	
00200	LSTNXT:	MOVNI 1,1
00300		RLJFN
00400		JFCL
00500		AOBJN X,LSTLUP
00600		MOVE 1,RECJFN
00700		HRLI 1,400000
00800		CLOSF
00900		0
01000		MOVE 1,[POINT 7,RECIMG]
01100		SKIPN RECSWB
01200		 JRST NOSSW
01300		MOVEI 2,"/"
01400		IDPB 2,1
01500		HRROI 2,RECSWB
01600		SETZ 3,
01700		SOUT
01800	NOSSW:	MOVEM 1,RECPTR#
01900		SKIPL X,RECFCT
02000		JRST OURECE
02100	OURECL:	HLRZ 1,RECFVR(X)
02200		CAIN 1,-1
02300		 JRST NOFIX2		; NOT LISTED
02400		MOVE 1,RECFVR(X)
02500		HRLI 1,100001
02600		MOVE 2,RECFPT(X)
02700		GTJFN
02800		 JRST NOFIX1
02900	IFN KL20F,<
03000		MOVE 2,[1,,24]
03100		MOVEI 3,3
03200		GTFDB			; GET "USEr settable word"
03300		AOS 3			; ADD ONE TO IT
03400		HRROI 2,777777		; MASK ONLY COUNT FIELD
03500		HRLI 1,24		; CHANGING WORD 24
03600		CHFDB
03700	>
03800	IFN KA10F,<
03900		MOVE 2,[1,,6]
04000		MOVEI 3,3
04100		GTFDB
04200		MOVEI 3,1(3)
04300		MOVEI 2,777777
04400		HRLI 1,6
04500		CHFDB
04600		SOJG 3,NOFIX6
04700		HRLI 1,1
04800		MOVSI 2,400
04900		MOVSI 3,400
05000		CHFDB
05100	>
05200	; ..
     
00100	
00200	; ..
00300	
00400	NOFIX6:	HRRZS 1
00500		RLJFN
00600		 0
00700	NOFIX1:	HLRE 1,RECFVR(X)
00800		JUMPLE 1,NOFIX2		; MOST RECENT VERSION, DON'T TOUCH FDB
00900		HRRZ 2,RECFVR(X)
01000		CAMN 1,2
01100		 JRST NOFIX2
01200		MOVE 2,RECFPT(X)
01300		HRLI 1,100001
01400		GTJFN
01500		 JRST NOFIX3
01600	IFN KL20F,<
01700		MOVE 2,[1,,24]
01800		MOVEI 3,3
01900		GTFDB
02000		SKIPE 3
02100		SOS 3
02200		HRROI 2,777777
02300		HRLI 1,24
02400	>
02500	IFN KA10F,<
02600		MOVE 2,[1,,6]
02700		MOVEI 3,3
02800		GTFDB
02900		TRNE 3,777777
03000		MOVEI 3,-1(3)
03100		MOVEI 2,777777
03200		HRLI 1,6
03300	>
03400		CHFDB
03500		HRRZS 1
03600		RLJFN
03700		 JFCL
03800	IFN KA10F,<		; REMOVE UNDELETABLE BIT FOR INTERMEDIATE VERSIONS
03900	NOFIX5:	HLRZ 1,RECFVR(X)
04000		HRRZ 2,RECFVR(X)
04100		CAML 1,2
04200		 JRST NOFIX2
04300		MOVE 2,RECFPT(X)
04400		HRLI 1,100001
04500		GTJFN
04600		 JRST NOFIX3
04700		MOVE 2,[1,,6]
04800		MOVEI 3,3
04900		GTFDB
05000		TRNE 3,777777
05100		 JRST NOFIX7
05200		HRLI 1,1
05300		MOVSI 2,400
05400		SETZ 3,
05500	; ..
     
00100	
00200	; ..
00300	
00400		CHFDB
00500	NOFIX7:	HRRZS 1
00600		RLJFN
00700		 0
00800	NOFIX3:	MOVSI 1,1
00900		ADDM 1,RECFVR(X)
01000		JRST NOFIX5
01100	>
01200	IFN KL20F,<
01300	NOFIX3:
01400	>
     
00100	
00200	NOFIX2:	MOVE 1,RECPTR
00300		MOVE 2,RECFPT(X)
00400		MOVEI 3,0
00500		SOUT
00600	IFN KA10F,<MOVEI 2,";">
00700	IFN KL20F,<MOVEI 2,".">
00800		IDPB 2,1
00900		HRRZ 2,RECFVR(X)
01000		MOVEI 3,12
01100		NOUT
01200		0
01300		MOVEI 2,15
01400		IDPB 2,1
01500		MOVEI 2,12
01600		IDPB 2,1
01700		MOVEM 1,RECPTR
01800		AOBJN X,OURECL
01900	; ..
     
00100	
00200	; ..
00300	
00400	OURECE:	MOVEI 2,15
00500		IDPB 2,1
00600		MOVEI 2,12
00700		IDPB 2,1
00800		SETZ 2,
00900		IDPB 2,1
01000		MOVE 1,RECJFN
01100		MOVE 2,[XWD 70000,100000]
01200		OPENF
01300		0
01400		HRROI 2,RECIMG
01500		SETZ 3,
01600		SOUT
01700		HRLI 1,400000
01800		CLOSF
01900		JFCL
02000		TRNN F,LSTF
02100		JRST NLIST
02200		SKIPN NCOPY
02300		HALTF
02400		HRROI B,[ASCIZ /LPT:/]
02500		MOVSI 1,1
02600		GTJFN
02700		HALTF
02800		MOVEM 1,LSTJFN
02900		MOVE 2,[XWD 70000,100000]
03000		OPENF
03100		HALTF
03200		HRROI B,[ASCIZ /LISTING.;T/]
03300		MOVSI 1,1
03400		GTJFN
03500		HALTF
03600		MOVEM 1,IN2JFN
03700		MOVE 2,[XWD 70000,200000]
03800		OPENF
03900		HALTF
04000		HRROI B,[ASCIZ /DIFFERENCES.;T/]
04100		MOVSI 1,1
04200		GTJFN
04300		HALTF
04400		MOVEM 1,IN1JFN
04500		MOVE 2,[XWD 70000,200000]
04600		OPENF
04700		HALTF
04800	; FALLS THRU
     
00100	
00200	; FALLEN INTO
00300		TMSG [ASCIZ /
00400	Generating copies.../]
00500		MOVE 1,LSTJFN
00600		HRROI 2,[ASCIZ /
00700	
00800	Listing updates generated from /]
00900		SETZ 3,
01000		SOUT
01100		MOVE 2,RECJFN
01200		JFNS
01300		HRROI 2,[ASCIZ /
01400	/]
01500		SOUT
01600		MOVE 1,IN1JFN
01700		SETO 2,
01800		SFPTR
01900		JFCL
02000		RFPTR
02100		 JFCL
02200		MOVEM 2,LEN1#
02300		MOVE 1,IN2JFN
02400		SETO 2,
02500		SFPTR
02600		JFCL
02700		RFPTR
02800		 JFCL
02900		MOVEM 2,LEN2#
03000		MOVE C,NCOPY
03100	CPYLP:	SETZM BYTEN1#
03200		SETZM BYTEN2#
03300		MOVE 1,LSTJFN
03400		HRROI B,CPLBUF
03500		SETZ C,
03600		SOUT
03700		TRNE F,DIFFSF
03800		 JRST CPY3LP
03900		MOVEI 2,14
04000		BOUT
04100	CPY2LP:	MOVE 4,LEN1
04200		SUB 4,BYTEN1
04300		JUMPE 4,CPY3LP
04400		CAILE 4,5000
04500		 MOVEI 4,5000
04600		MOVE 1,BYTEN1
04700		ADDM 4,BYTEN1
04800		IDIVI 1,5000
04900		HRL 1,IN1JFN
05000		MOVE 2,[400000,,MAPPAG]
05100		MOVSI 3,100000
05200		PMAP
05300		MOVN 3,4
05400		MOVE 1,LSTJFN
05500		HRROI 2,MAPPAG*1000
05600		SOUT
05700		JRST CPY2LP
     
00100	
00200	CPY3LP:	MOVEI 2,14
00300		MOVE 1,LSTJFN
00400		BOUT
00500	CPY4LP:	MOVE 4,LEN2
00600		SUB 4,BYTEN2
00700		JUMPE 4,CPY5LP
00800		CAILE 4,5000
00900		 MOVEI 4,5000
01000		MOVE 1,BYTEN2
01100		ADDM 4,BYTEN2
01200		IDIVI 1,5000
01300		HRL 1,IN2JFN
01400		MOVE 2,[400000,,MAPPAG]
01500		MOVSI 3,100000
01600		PMAP
01700		MOVN 3,4
01800		MOVE 1,LSTJFN
01900		HRROI 2,MAPPAG*1000
02000		SOUT
02100		JRST CPY4LP
02200	
02300	CPY5LP:	MOVEI 2,14
02400		MOVE 1,LSTJFN
02500		BOUT
02600		SOJG C,CPYLP
02700		MOVE 2,[400000,,MAPPAG]
02800		SETO 1,
02900		PMAP
03000		MOVNI 1,1
03100		CLOSF
03200		JFCL
03300		MOVE 1,RECJFN
03400		RLJFN
03500		 JFCL
03600		HALTF
03700		JRST START
03800	
03900	NLIST:	TMSG [ASCIZ /
04000	No files needed listing/]
04100		MOVE 1,RECJFN
04200		RLJFN
04300		 JFCL
04400		HALTF
04500		JRST START
     
00100	
00200	; SET SWITCHES
00300	
00400	;;* This needs some work. change bins to pstins for TENEX, then put
00500	;;* in RDTTY for T20.
00600	SETSWI:	TLO	F,IGL			;* SET X TO START
00700	SETSWT: HRROI 1,[ASCIZ /Switches (0 or more of B,C,S,L,P,F,U,D,M,N,W,X,?): /]
00800		PSOUT
00900		MOVEI 1,100
01000	SETFSW:	MOVEM F,SAVEF#
01100	
01200	SETSW1:	MOVEI 2,1
01300		MOVEM 2,SIGNF#
01400		SETZM SWTNUM#
01500	SETSW3:	BIN
01600		CAIN 2,15
01700		 BIN				; EAT FOLLOWING LF
01800		CAIN 2,177
01900		 JRST SETSWR
02000		CAILE 2,140
02100		 TRZ 2,40
02200		CAIL 2,"0"
02300		CAILE 2,"9"
02400		 SKIPA
02500		  JRST SWTDIG
02600		CAIN 2,"-"
02700		 JRST SETNEG
02800		CAIN 2,"C"
02900		 JRST SETSWC
03000		CAIN 2,"S"
03100		 JRST SETSWS
03200		CAIN 2,"B"
03300		 JRST SETSWB
03400		CAIN 2,"L"
03500		 JRST SETSWL
03600		CAIN 2,"P"
03700		 JRST SETSWP
03800		CAIN 2,"F"
03900		 JRST SETSWF
04000		CAIN 2,"U"
04100		 JRST SETSWU
04200		CAIN 2,"D"
04300		 JRST SETSWD
04400		CAIN 2,"M"
04500		 JRST SETSWM
04600		cain 2,"X"
04700		 jrst SETSOS
04800		CAIN 2,"N"
04900		 JRST SETSWN
05000		CAIN 2,"W"
05100		 JRST SETSWW
05200		CAIN 2,"?"
05300		 JRST SETSWQ
05400		CAIE 2,12
05500		CAIN 2,37
05600		 POPJ P,
05700		PUSH P,1
05800		HRROI 1,[ASCIZ / Unrecognized switch/]
05900		ESOUT
06000		MOVE 2,0(P)
06100		HRROI 1,[ASCIZ / in RECORDOFLISTINGS file/]
06200		CAIE 2,100
06300		 PSOUT
06400		HRROI 1,[ASCIZ /.
06500	/]
06600		PSOUT
06700		POP P,1
06800		CAIN 1,100
06900		ANDCM F,[IGB!IGC!IGP!IGS!IGU!NOASK,,DIFFSF!FIXUP]
07000		JRST SETSWT
07100		POPJ P,
07200	
07300	SETSWR:	HRROI 1,[ASCIZ /XXX
07400	/]
07500		PSOUT
07600		MOVE F,SAVEF
07700		JRST SETSWT
07800	
07900	SWTDIG:	SUBI 2,"0"
08000		EXCH 2,SWTNUM
08100		IMULI 2,^D10
08200		ADDM 2,SWTNUM
08300		JRST SETSW3
08400	
08500	SETSWL:	MOVE 2,SWTNUM
08600		CAIL 2,1
08700		 MOVEM 2,NMATLN
08800		JRST SETSW1
08900	
09000	SETSWC:	MOVSI 2,IGC
09100		JRST SETSW2
09200	
09300	;;*
09400	SETSOS:	movsi 2,igl
09500		jrst SETSW2
09600	
09700	SETSWS:	MOVSI 2,IGS
09800		JRST SETSW2
09900	
10000	SETSWB:	MOVSI 2,IGB
10100		JRST SETSW2
     
00100	
00200	SETSWP:	MOVSI 2,IGP
00300		JRST SETSW2
00400	
00500	SETSWF:	MOVSI 2,IGB!IGS!IGP
00600		JRST SETSW2
00700	
00800	SETSWU:	MOVSI 2,IGU
00900		JRST SETSW2
01000	
01100	SETSWD:	MOVEI 2,DIFFSF
01200		JRST SETSW2
01300	
01400	SETSWM:	MOVEI 2,FIXUP
01500		JRST SETSW2
01600	
01700	SETSWN:	MOVSI 2,NOASK
01800		JRST SETSW2
01900	
02000	SETSWW:	MOVEI 2,UCPTOO
02100	SETSW2:	SKIPGE SIGNF
02200		TDZA F,2
02300		TDO F,2
02400		JRST SETSW1
02500	
02600	SETNEG:	MOVNS SIGNF
02700		JRST SETSW3
02800	
02900	SETSWQ:	HRROI 1,[ASCIZ /
03000	Current switch settings: /]
03100		PSOUT
03200		MOVSI 2,-6
03300	STSQL1:	HLRZ 1,SWST1(2)
03400		TSNN F,1
03500		 JRST STSQL2
03600		HRRZ 1,SWST1(2)
03700		PBOUT
03800	STSQL2:	AOBJN 2,STSQL1
03900		MOVSI 2,-3
04000	STSQL3:	HLRZ 1,SWST2(2)
04100		TDNN F,1
04200		 JRST STSQL4
04300		HRRZ 1,SWST2(2)
04400		PBOUT
04500	STSQL4:	AOBJN 2,STSQL3
04600		HRROI 1,STSWQM
04700		PSOUT
04800		JRST SETSWT
04900	
05000	SWST1:	IGC,,"C"
05100		IGS,,"S"
05200		IGB,,"B"
05300		igl,,"X"
05400		IGP,,"P"
05500		IGU,,"U"
05600		NOASK,,"N"
05700	
05800	SWST2:	UCPTOO,,"W"
05900		FIXUP,,"M"
06000		DIFFSF,,"D"
06100	
06200	STSWQM:	ASCIZ \
06300	Switches are:
06400	-: Clear the next switch
06500	C: Ignore changes in comments
06600	S: Ignore spacing/tab changes
06700	B: Ignore blank lines
06800	X: Ignore SOS line numbers
06900	P: Ignore pagination changes
07000	F: Ignore format changes (bsp)
07100	L: Set lines to achieve match to the number preceding the l
07200	U: Ignore upper/lower case distinction
07300	D: Produce no differences listing
07400	M: Allow fixup of missing files
07500	N: No ask to continue searching with long changes
07600	W: Whole listing (not changed pages only)
07700	\
     
00100	
00200	ERR:	HRROI 1,[ASCIZ //]
00300		ESOUT
00400	NOREC:	TMSG [ASCIZ /
00500	Compare file: /]
00600		PUSHJ P,GETNAM			;* Get the first file name
00700		JRST ERR			;* Couldn't do it
00800		MOVEM A,IN1JFN#			;* Save the JFN
00900		TMSG [ASCIZ / With file: /]
01000		MOVE A,[POINT 7,PAGBUF]
01100		MOVE B,IN1JFN
01200		SETZB C,DEFDEV
01300		SETZM DEFDIR
01400		IDPB C,A
01500		MOVEM A,DEFNAM
01600		MOVSI 3,1000
01700		JFNS
01800		IDPB C,A
01900		MOVEM A,DEFEXT
02000		MOVSI 3,100
02100		JFNS
02200		IDPB C,A
02300		MOVE A,[XWD 100000,-2]
02400		MOVEM A,DEFVER
02500		MOVE A,PRIMRY
02600		MOVEM A,DEFFIL
02700		MOVEI A,DEFVER
02800		MOVEI B,0
02900		GTJFN
03000		JRST ERR
03100		MOVEM A,IN2JFN#
     
00100	
00200		TMSG [ASCIZ /
00300	Marked listing to file: /]
00400		MOVE A,[XWD 460000,0]
00500		MOVEM A,DEFVER
00600		MOVE A,[POINT 7,[ASCIZ/LST/]]
00700		MOVEM A,DEFEXT
00800		PUSHJ P,GETDNM		; GET DEFAULT NAME
00900		JRST [	TRZ F,OPN1
01000			JRST STRT1]
01100		MOVEM A,LSTJFN#
01200		DVCHR
01300		HLRZS A
01400		ANDI A,777
01500		CAIN A,12
01600		 TLO F,QUIETF
01700		TRO F,OPN1
01800		SETZM CH2POS#
01900	STRT0:	TRO F,UCPTOO
02000	STRT1:	TMSG [ASCIZ /Differences to file: /]
02100		MOVE A,[POINT 7,[ASCIZ/DIF/]]
02200		MOVEM A,DEFEXT
02300		PUSHJ P,GETDNM
02400		JRST [	TRZ F,OPN2
02500			JRST STRT11]
02600		MOVEM A,DIFJFN#
02700		DVCHR
02800		HLRZS A
02900		ANDI A,777
03000		CAIN A,12
03100		 TLO F,QUIETF
03200		TRO F,OPN2
03300	STRT11:	
03400		CALL SETSWI			;* MY VERSION (WITH "X" ON)
03500	;;	CALL SETSWT			;* Get the switches
03600		PUSHJ P,STRT2			;* Then GO!!!
03700		HALTF				;* Normal stop here
03800		JRST	START			;* Restart
     
00100	
00200	; COMPARE ONE FILE
00300	
00400	STRT2:	TRNE F,UCPTOO
00500		 JRST STRT9
00600		MOVE A,[POINT 7,PAGBUF]
00700		EXCH A,LSTJFN
00800		MOVEM A,XLSJFN#
00900		SETZM CHANGE
01000	STRT9:	TLZ F,BRF!BRF2
01100		MOVE A,CPLPTR
01200		MOVEM A,CPLPTL#
01300		HRROI B,[ASCIZ /
01400	Pages changed in /]
01500		SETZ CH,
01600		SOUT
01700		MOVE 2,IN1JFN
01800		JFNS
01900		HRROI B,[ASCIZ /: /]
02000		SOUT
02100		MOVEM A,CPLPTR
02200		HRROI 1,PAGBUF		; A GOOD RANDOM PLACE TO PUT A STRING
02300		MOVE 2,IN1JFN
02400		MOVSI 3,(1B11)
02500		JFNS
02600		MOVE 1,PAGBUF
02700		MOVSI 2,";"		; ASSUME .MAC
02800		CAMN 1,[ASCII /BCP/]
02900		MOVE 2,["/",,"/"]
03000		CAMN 1,[ASCII /F4/]
03100		HRLOI 2,"C"
03200		CAMN 1,[ASCII /BLI/]
03300		MOVSI 2,"!"
03400		HLRZM 2,COMNT1
03500		HRREM 2,COMNT2
03600		MOVE 1,IN1JFN
03700		MOVE 2,[XWD 440000,200000]
03800	;;*	MOVE 2,[XWD 070000,200000]
03900		OPENF
04000		 JRST [	HRROI 1,[ASCIZ / Can't open /]
04100			ESOUT
04200			MOVEI 1,101
04300			MOVE 2,IN1JFN
04400			SETZ 3,
04500			JFNS
04600			RET]
04700	;;* SET UP POINTERS FOR PMAP
04800		PUSH	P,B			;* SAVE THE OPENF MODE WORD
04900		SETO	B,
05000		SFPTR
05100		JRST	ERR
05200		RFPTR
05300		JRST	ERR
05400		IDIVI	B,1000
05500		MOVEM	B,PGCNT1		;* THE PAGE COUNT
05600		addi	3,2			;* ASSIST THE LAST PAGE COUNTER
05700		MOVNM	3,ODCNT1		;* THE ODD (LAST PAGE) COUNT
05800		SETZM	PPNT1			;* CHARACTER COUNTER INITIALIZED TO 0
05900	;;* END OF INSERTION
06000		MOVE 1,IN2JFN
06100		POP	P,B			;* RESTORE THE OPENF MODE WORD
06200		OPENF
06300		 JRST [	HRROI 1,[ASCIZ / Can't open /]
06400			ESOUT
06500			MOVEI 1,101
06600			MOVE 2,IN2JFN
06700			SETZ 3,
06800			JFNS
06900			RET]
07000	;;* SET UP POINTERS FOR PMAP
07100		SETO	B,
07200		SFPTR
07300		JRST	ERR
07400		RFPTR
07500		JRST	ERR
07600		IDIVI	B,1000
07700		MOVEM	B,PGCNT2		;* THE PAGE COUNT
07800		addi	3,2			;* TO ASSIST COUNTER ON LAST PAGE
07900		MOVNM	3,ODCNT2		;* THE ODD (LAST PAGE) COUNT
08000		SETZM	PPNT2			;* CHARACTER COUNTER INITIALIZED TO 0
08100	;;* END OF INSERTION
08200		MOVE 2,[XWD 070000,100000]
08300		TRNE F,APPEND
08400		HRRI 2,020000
08500		TRNN F,OPN1
08600		JRST STRT3
08700		TRNN F,UCPTOO
08800		SKIPA 1,XLSJFN
08900		MOVE 1,LSTJFN
09000		OPENF
09100		 JRST [	HRROI 1,[ASCIZ / Can't open file for listing/]
09200			ESOUT
09300			RET]
09400	STRT3:	TRNN F,OPN2
09500		JRST STRT31
09600		MOVE 1,DIFJFN
09700		OPENF
09800		 JRST [	HRROI 1,[ASCIZ / Can't open file for differences/]
09900			ESOUT
10000			RET]
     
00100	
00200	STRT31:	MOVEI A,IBUF1
00300		MOVEM A,BUF1
00400		MOVEI A,IBUF2
00500		MOVEM A,EBUF1#
00600		MOVEM A,BUF2
00700		MOVEI A,777777
00800		MOVEM A,EBUF2#
00900		MOVEI A,1
01000		MOVEM A,LINE1
01100		MOVEM A,LINE2
01200		MOVEM A,PAGE1
01300		MOVEM A,PAGE2
01400		TRZ F,EOF1!EOF2!MRK!MSG!NEDHDG
01500		SETZM LSTPGE#
01600		SETZM IN1
01700		SETZM IN2
01800		MOVE A,[POINT 7,HDNG]
01900		HRROI B,[ASCIZ /
02000	
02100	; /]
02200		MOVEI 3,0
02300		SOUT
02400		MOVE B,IN1JFN
02500		JFNS
02600		HRROI B,[ASCIZ / & /]
02700		SOUT
02800		MOVE B,IN2JFN
02900		JFNS
03000		MOVEI B,40
03100		IDPB 2,1
03200		MOVNI 2,1
03300		MOVSI 3,(1B10!1B12)
03400		ODTIM
03500		HRROI B,[ASCIZ /	PAGE /]
03600		SETZ 3,
03700		SOUT
03800		SETZB B,PAGEY#
03900		IDPB B,A
04000		PUSHJ P,PRHDNG
04100		SETZM PAGED#
04200		SETZM DFLINE#
04300		PUSHJ P,DFHDN1
04400	LUP0:	SKIPN IN1
04500		SKIPE IN2
04600		JRST LUP01
04700		TRNE F,EOF1
04800		TRNN F,EOF2
04900		JRST LUP01
05000	; FALLS THRU
     
00100	
00200	; FALLEN INTO
00300	LUP00:	OUTC2 14
00400		TRZN	F,NEDHDG	; JUST END A PAGE?
00500		 OUTC1	14		; NO, SKIP TO END OF PAGE
00600		TRNN	F,UCPTOO	; FOR CHANGED PAGES,
00700		PUSHJ	P,EMPTBX	; MAKE SURE WE OUTPUT EVERYTHING
00800		TLZE F,BRF		; GOT TO COMPLETE PAGE RANGE
00900		 PUSHJ P,FIXBRF
01000	LUP00Z:	TRNE F,MSG
01100		 JRST LUP00Y
01200		HRROI B,[ASCIZ /None/]
01300		MOVE A,CPLPTR
01400		SETZ CH,
01500		SOUT
01600		MOVEM A,CPLPTR
01700	LUP00Y:	HRROI B,[ASCIZ /
01800	/]
01900		MOVE A,CPLPTR
02000		SETZ CH,
02100		SOUT
02200		MOVEM A,CPLPTR
02300	;;*
02400		TRNE	F,MSG			;* DON'T OUTPUT MESSAGE IF NO PAGE CHANGE
02500		PUSHJ P,CPLOUT
02600	;;*
02700		push p,a
02800		SETO 1,
02900		MOVE 2,[400000,,PAG1]
03000		PMAP
03100		MOVE 2,[400000,,PAG2]
03200		PMAP
03300		pop	p,a
03400	;;*
03500		SKIPE A,IN1JFN
03600		CLOSF
03700		JFCL
03800		SKIPE A,IN2JFN
03900		CLOSF
04000		JFCL
04100		SKIPE A,LSTJFN
04200		CLOSF
04300		JFCL
04400		SKIPE A,XLSJFN
04500		CLOSF
04600		JFCL
04700		SKIPE A,DIFJFN
04800		CLOSF
04900		JFCL
05000		POPJ P,
05100	
05200	LUP01:	HRRZ	PT1,LSTJFN	; SEE IF BUFFER IS FULL
05300		CAILE	PT1,PAGBUF+NPGBF-100	; OR JUST ABOUT
05400		PUSHJ	P,EMPTBF	; TIME TO GIVE UP
05500		MOVE PT1,BUF1
05600		MOVE PT2,BUF2
05700		HRLI PT1,(<POINT 7,0>)
05800		HRLI PT2,(<POINT 7,0>)
05900		PUSHJ P,RDL1		; READ A LINE FROM FILE 1
06000		PUSHJ P,RDL2		; AND FILE 2
06100		MOVE A,BUF1
06200		MOVE B,BUF2
06300		PUSHJ P,COMP1		; COMPARE ONE LINE
06400		JRST NEQ
06500		MOVE B,A		; END OF LINES COMPARED
06600		MOVE A,BUF1		; BEGINNING OF LINES COMPARED
06700		TRNE F,OPN1		; LISTING FILE?
06800		PUSHJ P,OUT1		; COPY LINE TO LISTING
06900		MOVE A,LINCT1
07000		ADDM A,LINE1
07100		MOVE A,LINCT2
07200		ADDM A,LINE2
07300		SKIPN A,NPAG
07400		JRST LUP0		; GO BACK FOR NEXT LINE
07500		ADDM A,PAGE1
07600		ADDM A,PAGE2
07700		MOVEI A,1
07800		MOVEM A,LINE1
07900		MOVEM A,LINE2
08000		JRST LUP0
     
00100	
00200	NEQ:	MOVE A,DFLINE
00300		CAIL A,^D45
00400		PUSHJ P,DFHDNG
00500		TRO F,MRK
00600	 	PUSHJ P,RD4L1		; READ 4 MORE LINES
00700		PUSHJ P,RD4L2
00800		SKIPE IN1
00900		JRST [	PUSHJ P,RDL1
01000			JRST .-1]
01100		SKIPE IN2
01200		JRST [	PUSHJ P,RDL2
01300			JRST .-1]
01400		MOVE HGH1,BUF1
01500		MOVE HGH2,BUF2
01600		MOVSI CNT,-^D100
01700	NEQ0:	PUSHJ P,RDL1
01800		PUSHJ P,RDL2
01900		MOVE A,HGH1
02000		PUSHJ P,SKP1L
02100		MOVEM A,HGH1
02200		MOVE A,HGH2
02300		PUSHJ P,SKP1L
02400		MOVEM A,HGH2
02500		MOVE SCN1,BUF1
02600		MOVE SCN2,BUF2
02700	NEQ1:	MOVE A,SCN1
02800		MOVE B,HGH2
02900		PUSHJ P,C4L
03000		JRST NEQ2
03100		MOVE A,SCN1
03200		MOVE B,HGH2
03300		JRST OUTDIF
     
00100	
00200	NEQ2:	MOVE A,HGH1
00300		MOVE B,SCN2
00400		PUSHJ P,C4L
00500		JRST NEQ3
00600		MOVE A,HGH1
00700		MOVE B,SCN2
00800	OUTDIF:	MOVEM A,ENDL1
00900		MOVEM B,ENDL2
01000		TRO F,MRK
01100		TRNE F,OPN1
01200		PUSHJ P,OUTB1
01300		TRZ F,MRK
01400		OUTM2 [ASCIZ /
01500	
01600	/]
01700		MOVEI X,0
01800		PUSHJ P,OUTBLK
01900		MOVEI X,1
02000		PUSHJ P,OUTBLK
02100		MOVE A,ENDL1
02200		HRLI A,(<POINT 7,0>)
02300		MOVEM A,IN1
02400		MOVE A,ENDL2
02500		HRLI A,(<POINT 7,0>)
02600		MOVEM A,IN2
02700		MOVEM PT1,INE1
02800		MOVEM PT2,INE2
02900		JRST LUP0
     
00100	
00200	NEQ3:	MOVE A,SCN1
00300		CAMN A,HGH1
00400		JRST NEQ4
00500		PUSHJ P,SKP1L
00600		MOVEM A,SCN1
00700		MOVE A,SCN2
00800		PUSHJ P,SKP1L
00900		MOVEM A,SCN2
01000		JRST NEQ1
01100	
01200	NEQ4:	AOBJN CNT,NEQ0
01300		MOVEI 1,100
01400		CFIBF			; FLUSH ANY TYPE-AHEAD
01500		TMSG [ASCIZ /
01600	There is a very long change of at least /]
01700		HRRZ A,CNT
01800		PUSHJ P,TYPNUM
01900		TMSG [ASCIZ / lines./]
02000		TLNN F,NOASK
02100		 JRST NEQ47
02200		TMSG [ASCIZ /
02300	Continue assumed./]
02400		MOVEI 1,NEQ0
02500		JRST NEQ48
02600	
02700	NEQ47:	TMSG [ASCIZ /
02800	C, M, or N? /]
02900	NEQ41:	SKIPE 1,TIMFRK		; DO WE HAVE A TIMER FORK?
03000		 JRST NEQ40		; YES
03100		MOVSI 1,(1B0!1B1)
03200		CFORK
03300		 JRST NEQ43		; CAN'T DO IT
03400		MOVEM 1,TIMFRK
03500		FFORK
03600	NEQ40:	MOVEI 2,TIMER
03700		SFORK
03800		RFORK
03900	; ..
     
00100	
00200	; ..
00300	
00400	NEQ43:	PBIN
00500		MOVE CH,1
00600		SKIPE 1,TIMFRK
00700		 FFORK
00800		CAIN CH,177		; RUBOUT?
00900		 JRST NEQ45
01000		CAIN CH,"?"
01100		 JRST NEQ46
01200		TRZ CH,40		; CONVERT TO UPPER CASE
01300		MOVEI 1,NEQ42		; DEFAULT DISPATCH
01400		CAIN CH,"C"
01500		MOVEI 1,NEQ0
01600		CAIN CH,"N"
01700		MOVEI 1,NEQQQQ
01800		CAIN CH,"M"
01900		MOVEI 1,NEQ44
02000	NEQ48:	PUSH P,1
02100		HRLI CNT,-^D100
02200		TMSG [ASCIZ /
02300	/]
02400		POPJ P,
02500	
02600	NEQ42:	HRROI 1,[ASCIZ / Type "C" to continue, "M" to force a match, and "N" to abort. /]
02700		ESOUT
02800		JRST NEQ41
02900	
03000	NEQ44:	MOVE A,HGH1
03100		MOVE B,HGH2
03200		JRST OUTDIF
03300	
03400	NEQ46:	TMSG [ASCIZ /
03500	/]
03600		XCT NEQ42
03700		PSOUT
03800		JRST NEQ41
03900	
04000	NEQ45:	HRROI 1,[ASCIZ /XXX/]
04100		PSOUT
04200		JRST NEQ47
04300	
04400	NEQQQQ:	OUTM2 [ASCIZ /
04500	...
04600	Plus many more differences./]
04700		JRST LUP00
     
00100	
00200	TIMER:	MOVEI 1,^D30000
00300		DISMS
00400		HRROI 1,[ASCIZ /
00500	(Time-out. Continue assumed) /]
00600		PSOUT
00700		MOVEI 2,"C"
00800		MOVEI 1,100
00900		STI
01000		HALTF
01100	
     
00100	
00200	; PRINT A NUMBER ON DIFFERENCE FILE
00300	
00400	OUTN2:	TRNN F,OPN2
00500		POPJ P,
00600		PUSH P,1
00700		PUSH P,2
00800		PUSH P,3
00900		MOVE 2,A
01000		MOVE 1,DIFJFN
01100		MOVEI 3,^D10
01200		NOUT
01300		JFCL
01400		POP P,3
01500		POP P,2
01600		POP P,1
01700		POPJ P,
01800	
01900	TYPNUM:	MOVE B,A
02000		HRRZ 1,PRIMRY
02100		MOVEI 3,12
02200		NOUT
02300		POPJ P,
02400		POPJ P,
     
00100	
00200	NOTHER:	SUB P,[2,,2]		; FLUSH THIS JUNK
00300	NOTHE4:	TMSG	[ASCIZ/
00400	File in RECORDOFLISTINGS not found: /]
00500		MOVE	1,RECFPT(X)		; GET POINTER TO FILE NAME
00600		PSOUT				; AND PRINT IT
00700	IFN KA10F,<CHOUT ";">
00800	IFN KL20F,<CHOUT ".">
00900		HRRZ	1,PRIMRY	; OUTPUT
01000		HRRZ	2,RECFVR(X)
01100		MOVEI	3,^D10		; CLUNK OUT VERSION #
01200		NOUT
01300		0			; NEVER HAPPEN (HE SAID)
01400		TMSG [ASCIZ/
01500	/]
01600		TRNN	F,FIXUP		; WANT TO STOP AND FIX IT?
01700		JRST	LSTNXT		; NOPE
01800		HRROI	1,NAM%		; BUILD A FILE NAME THERE
01900		MOVE	2,RECFPT(X)	; CURRENT NAME
02000		SETZ	3,
02100		SOUT
02200	IFN KA10F,<MOVEI 2,";">
02300	IFN KL20F,<MOVEI 2,".">
02400		IDPB	2,1
02500		MOVEI	2,"*"
02600		IDPB	2,1
02700		SETZ	3,
02800		IDPB	3,1		; NULL FER KICKS
02900		MOVSI	1,100101	; LOOKUP & STAR'S
03000		HRROI	2,NAM%
03100		GTJFN
03200		JRST	NOSTAR		; FILE DOESN'T EXIST
03300		MOVEM	1,XJFN#
03400		TMSG	[ASCIZ/Versions that do exist are:
03500	/]
03600		MOVE	1,XJFN		; FAKE THE LOOP
03700	NOTHE3:	HRRZ	2,1		; JUST WANT JFN
03800		HRRZ	1,PRIMRY
03900		MOVE	3,[001110,,1]	; NAME.EXT;VERSION
04000		JFNS
04100		TMSG [ASCIZ/
04200	/]
04300		MOVE	1,XJFN
04400		GNJFN
04500		JRST	.+2		; JUMP OUT OF LOOP
04600		JRST	NOTHE3
     
00100	
00200	NOTHE2:	TMSG	[ASCIZ/
00300	Desired version #: /]
00400		HLRZ	1,PRIMRY	; INPUT
00500		MOVEI	3,^D10		; VERSIONS ARE DECIMAL
00600		NIN
00700		JRST	NOTHE4
00800		PUSH	P,2
00900		BKJFN
01000		0			; WITH A STRAIGHT FACE
01100		PBIN
01200		CAIE	1,37
01300		CAIN	1,12
01400		 CAIA
01500		  JRST	NOTHE2
01600		POP	P,2		; RESTORE VERSION #
01700		HRRM	2,RECFVR(X)	; NEW ONE
01800		JRST	LSTLUP		; TRY AGAIN...
01900	
02000	
02100	NOSTAR:	TMSG	[ASCIZ/No versions of above file in connected directory
02200	/]
02300		JRST	LSTNXT
02400	
     
00100	
00200	EMPTBX:	PUSH P,1
00300		MOVE 1,[POINT 7,PAGBUF]
00400		CAMN 1,LSTJFN		; EMPTY BUFFER?
00500		 JRST EMPTBZ		; YES
00600		OUTC1 14		; TERMINATE WITH FF
00700		JRST EMPTB2
00800	
00900	EMPTBF:	PUSH	P,1
01000	EMPTB2:	PUSH	P,2
01100		PUSH	P,3
01200		SETZ	2,
01300		IDPB	B,LSTJFN
01400		MOVE	A,XLSJFN
01500		HRROI	2,PAGBUF
01600		SETZ	3,
01700		SKIPL	CHANGE
01800		SOUT
01900		TRNN	F,MRK
02000		SETOM	CHANGE
02100		MOVE	A,[POINT 7,PAGBUF]
02200		MOVEM	A,LSTJFN
02300		POP	P,3
02400		POP	P,2
02500	EMPTBZ:	POP	P,1
02600		POPJ	P,
     
00100	
00200	OUTBLK:	MOVE A,ENDL1(X)
00300		PUSHJ P,SKP1L
00400		MOVEM A,ENDL1(X)
00500		OUTM2 [ASCIZ /LINE /]
00600		MOVE A,LINE1(X)
00700		PUSHJ P,OUTN2
00800		OUTM2 [ASCIZ /, PAGE /]
00900		MOVE A,PAGE1(X)
01000		PUSHJ P,OUTN2
01100		OUTM2 [ASCIZ /
01200	/]
01300		MOVE B,@BUFP(X)
01400	OUTBL1:	HRLI B,(<POINT 7,0>)
01500		OUTM2 HDM1(X)
01600	OUTBL2:	ILDB CH,B
01700		CAIN CH,14
01800		JRST [	OUTC2 "^"
01900			OUTC2 "L"
02000			AOS PAGE1(X)
02100			MOVEI A,1
02200			MOVEM A,LINE1(X)
02300			JRST OUTBL2]
02400		OUTC2 (CH)
02500		CAIE CH,12
02600		CAIN CH,37
02700		AOSA LINE1(X)
02800		CAIN CH,32
02900		JRST .+2
03000		JRST OUTBL2
03100		MOVEI B,1(B)
03200		CAME B,ENDL1(X)
03300		JRST OUTBL1
03400		POPJ P,
03500	
     
00100	
00200	
00300	OUT1:	PUSH P,B		; SAVE END POINT
00400	OUT1Q:	HRLI A,(<POINT 7,0>)
00500		CALL OUT1A
00600		MOVEI A,1(A)
00700		CAMGE A,0(P)
00800		 JRST OUT1Q
00900		SUB P,[1,,1]
01000		POPJ P,
01100	
01200	OUT1A:	PUSH P,A
01300		TRZE F,NEDHDG		; NEED HEADING?
01400		 PUSHJ P,PRHDNG		; YES, INSERT IT
01500		MOVE A,PAGE1
01600		TLNN F,IGP		; DON'T COMPARE IF IGNORING
01700		CAMN A,PAGE2
01800		TRNE F,MRK
01900		CAMG A,LSTPGE
02000		JRST QA
02100		AOS CHANGE
02200		PUSH P,A
02300		TRNN F,MSG
02400		 JRST QAY
02500		MOVE A,0(P)		; GET PAGE NUMBER
02600		SOS A
02700		CAME A,LSTPGE		; ONE GREATER THAN PREVIOUS PAGE?
02800		 JRST QAZ		; NO
02900		TLOE F,BRF		; REMEMBER PAGES ARE IN SEQUENCE
03000		TLO F,BRF2		; MORE THAN TWO IN SEQUENCE
03100		POP P,LSTPGE		; REMEMBER THE PAGE
03200		JRST QA
03300	
03400	QAZ:	TLZE F,BRF		; GOT TO COMPLETE PAGE RANGE
03500		 PUSHJ P,FIXBRF
03600		PUSHJ P,FIXBRC
03700	QAY:	TRO F,MSG
03800		POP P,B
03900		MOVEM B,LSTPGE
04000		MOVE A,CPLPTR
04100		MOVEI CH,^D10
04200		NOUT
04300		 JFCL
04400		MOVEM A,CPLPTR
04500	; ..
     
00100	
00200	; ..
00300	
00400	QA:	POP P,A
00500	OUT1B:	ILDB CH,A
00600		CAIN CH,14
00700		JRST QAFF
00800		CAIN CH,15
00900		TRNN F,MRK
01000		JRST QA2
01100		PUSH P,A
01200	QA3:	MOVE CH,CH2POS
01300		CAMG CH,RMARGN
01400		JRST QA4
01500		OUTM1 [ASCIZ /
01600	/]
01700		JRST QA3
01800	
01900	QA4:	CAML CH,RMARGN
02000		JRST QA5
02100		OUTC1 40
02200		JRST QA3
02300	
02400	QAFF:	TRNN F,MRK
02500		JRST QAFF1
02600		TLOE F,BRF
02700		TLO F,BRF2
02800		AOS LSTPGE
02900	QAFF1:	OUTC1 "^"
03000		OUTC1 "L"
03100		OUTC1 14
03200		TRNN F,UCPTOO
03300		 PUSHJ P,EMPTBF		; DUMP BUFFER TO LISTING
03400		TRO F,NEDHDG		; REMEMBER TO INSERT HEADING
03500		JRST OUT1B
03600	
03700	QA5:	OUTM1 [ASCIZ /|/]
03800		MOVEI CH,15
03900		POP P,A
04000	QA2:	CAIE CH,32
04100		OUTC1 (CH)
04200		CAIE CH,32
04300		CAIN CH,12
04400	CPOPJ:	POPJ P,
04500		JRST OUT1B
     
00100	
00200	OUTB1:	PUSH P,A
00300		MOVE A,BUF1
00400		CAME A,(P)
00500		JRST OUTB1A
00600		MOVE A,[XWD 440700,[ASCIZ /************* DELETION *************
00700	/]]
00800		PUSHJ P,OUT1A
00900		JRST OUTB1B
01000	
01100	OUTN1:	TRNN F,OPN1
01200		POPJ P,
01300		PUSH P,3
01400		PUSH P,A
01500		MOVE A,LSTJFN
01600		MOVEI 3,12
01700		NOUT
01800		JFCL
01900		MOVEM A,LSTJFN
02000		POP P,A
02100		POP P,3
02200		POPJ P,
02300	
02400	DFHDNG:	OUTC2 14
02500	DFHDN1:	SETZM DFLINE
02600		OUTM2 HDNG
02700		AOS A,PAGED
02800		PUSHJ P,OUTN2
02900		OUTM2 [ASCIZ /
03000	
03100	/]
03200		POPJ P,
03300	
03400	PRHDNG:	OUTM1 HDNG
03500		AOS B,PAGEY
03600		PUSHJ P,OUTN1
03700		OUTM1 [ASCIZ /
03800	
03900	/]
04000		POPJ P,
04100	
04200	OUTB1A:	HRLI A,(<POINT 7,0>)
04300		PUSHJ P,OUT1A
04400		MOVEI A,1(A)
04500		CAME A,(P)
04600		JRST OUTB1A
04700	OUTB1B:	TRZ F,MRK
04800		MOVE A,0(P)
04900		CALL SKP1L		; SKIP TO END OF THE NEXT LINE
05000		MOVE B,A
05100		POP P,A
05200		JRST OUT1
     
00100	
00200	FIXBRF:	TLZN F,BRF2
00300		 JRST FIXBR1
00400		HRROI B,[ASCIZ /../]
00500		MOVE A,CPLPTR
00600		SETZ CH,
00700		SOUT
00800		JRST FIXBR2
00900	
01000	FIXBR1:	PUSHJ P,FIXBRC
01100	FIXBR2:	MOVE B,LSTPGE
01200		MOVEI CH,^D10
01300		NOUT
01400		 JFCL
01500		MOVEM A,CPLPTR
01600		POPJ P,
01700	
01800	FIXBRC:	TLNN F,QUIETF
01900		 PUSHJ P,CPLOUT
02000		MOVEI A,","
02100		IDPB A,CPLPTR
02200		HRRZ A,CPLPTR
02300		HRRZ B,CPLPTL
02400		CAIG A,12(B)
02500		 JRST FIXBC1
02600		HRROI B,[ASCIZ /
02700	     /]
02800		MOVE A,CPLPTR
02900		SETZ CH,
03000		SOUT
03100		MOVEM A,CPLPTR
03200		MOVEM A,CPLPTL
03300		POPJ P,
03400	
03500	FIXBC1:	MOVE A,CPLPTR
03600		MOVEI B," "
03700		BOUT
03800		MOVEM A,CPLPTR
03900		POPJ P,
04000	
04100	CPLOUT:	MOVE B,CPLPT0
04200		MOVEI A,101
04300		SETZ CH,
04400		SOUT
04500		MOVE B,CPLPTR
04600		MOVEM B,CPLPT0
04700		POPJ P,
     
00100	
00200	DEFINE	RDL ' (N)<
00300	RD4L'N:	PUSH P,NMATLN
00400		PUSHJ P,RDL'N
00500		SOSLE 0(P)
00600		JRST .-2
00700		SUB P,[1,,1]
00800		POPJ P,
00900	
01000	RDL'N:	SETZM NPAG#
01100		SETZM LINCT'N
01200	RDL'N'N:
01300		TRZ F,TMPF
01400		MOVE A,EBUF'N
01500		SUBI A,(PT'N)
01600		CAIG A,200
01700		PUSHJ P,XPND'N
01800	
01900	RDL'N'X:
02000		SKIPN A,IN'N
02100		JRST RDL'N'A
02200	RDL'N'P:
02300		ILDB CH,A
02400		CAIE CH,12
02500		CAIN CH,32
02600		JRST .+2
02700		JRST RDL'N'Z
02800		TLNE A,760000
02900		JRST RDL'N'P
03000		CAMN A,INE'N
03100		MOVEI A,0
03200	RDL'N'Z:
03300		MOVEM A,IN'N
03400	RDL'N'B:
03500		JUMPE CH,RDL'N'X
03600		IDPB CH,PT'N
03700		CAIN CH,14
03800		AOS NPAG
03900		CAIN CH,15
04000		 JRST RDL'N'X
04100		CAIE CH,12
04200		CAIN CH,32
04300		JRST RDL'N'E
04400		TRO F,TMPF
04500		JRST RDL'N'X
04600	
04700	RDL'N'E:
04800		TLNE PT'N,760000
04900		JRST RDL'N'B
05000		AOS LINCT'N
05100		TLNE F,IGB
05200		TRNE F,TMPF
05300		 POPJ P,
05400		CAIN CH,12
05500		 JRST RDL'N'N
05600		POPJ P,
05700	
05800	RDL'N'A:
05900		MOVE 1,IN'N'JFN
06000	;*	BIN
06100		CALL	CHAR'N
06200		move ch,b
06300	
06400	;;	SKIPE CH,B
06500	;;	JRST RDL'N'B
06600	;;*
06700		MOVE	B,MAP'N
06800		CAMG	B,PGCNT'N		;* SKIP IF LAST PAGE
06900		JRST RDL'N'B
07000		HLRZ	B,PPNT'N
07100		CAIE	B,-1
07200	;	SKIPGE	B,PPNT'N		;* CUE OFF OF SIGN BIT FOR LAST CHAR
07300	;*	GTSTS
07400	;*	TLNN B,1000
07500		JRST RDL'N'B
07600		MOVEI CH,32
07700		TRO F,EOF'N
07800		JRST RDL'N'B
07900	
08000	
08100	
     
00100	
00200	CHAR'N:	SOSGE	CNTS'N			;ANY CHARS LEFT
00300		   JRST	MORE'N
00400		ILDB	2,BPS'N
00500		POPJ	P,
00600	
00700	MORE'N:	
00800		MOVE	B,PPNT'N		;* GET THE POINTER
00900	CONT'N:	AOBJP	B,NEWPG'N		;* BUMP THE COUNT
01000		MOVEM	B,PPNT'N		;* SAVE IT
01100		MOVE	B,PAG'N*1000(B)		;* GET THE WORD
01200	;;	BIN				;GET A WORD
01300		TLNN	F,IGL			; IGNORE SOS LINE NUMBERS??
01400		 JRST	.+5			; NO, TEST FOR THEM
01500		TRNE	2,1			;STOPGAP?
01600		  JRST	SSTOP'N			;YES
01700		CAMN	2,[XWD 64321,400000]	;STOPGAP PAGE
01800		  JRST	SOSP'N
01900		MOVEM	2,WRDS'N
02000		MOVEI	2,4			;NEW COUNT
02100		MOVEM	2,CNTS'N
02200		MOVE	2,[POINT 7,WRDS'N,6]
02300		MOVEM	2,BPS'N
02400		LDB	2,2			;GET A CHAR
02500		POPJ	P,			;AND RETURN
02600	
02700	SOSP'N:	SETZM	CNTS'N			;ZERO COUNT
02800		MOVEI	2,14			;AND RETURN A PAGE MARK
02900		POPJ	P,
03000	
03100	SSTOP'N:
03200		MOVE	B,PPNT'N		;* GET THE POINTER
03300	MORS'N:	AOBJP	B,NSSPG'N		;* BUMP THE COUNT
03400		MOVEM	B,PPNT'N		;* SAVE IT
03500		MOVE	B,PAG'N*1000(B)		;* GET THE WORD
03600	;;*	BIN		
03700		CAMN	2,[XWD 64321,400000]	;IS IT AN SOS PAGE?
03800		  JRST	SOSP'N			;YES
03900		MOVEM	2,WRDS'N
04000		MOVEI	2,3			;AFTER THE TAB AND THIS CHAR
04100		MOVEM	2,CNTS'N
04200		MOVE	2,[POINT 7,WRDS'N,13]
04300		MOVEM	2,BPS'N			;SAVE BP FOR NEXT TIME
04400		LDB	2,2
04500		POPJ	P,
04600	
04700	NSSPG'N:PUSH	P,[MORS'N]
04800		JRST	.+2
04900	NEWPG'N:
05000	
05100		PUSH	P,[CONT'N]
05200		move	b,map'n
05300		CAMle	B,PGCNT'N		;* SKIP IF LAST PAGE
05400		JRST test'n
05500	
05600		PUSH	P,A			;* SAVE THE JFN
05700		PUSH	P,CH			;* CH=3, WE BETTER SAVE IT
05800		HRL	A,A			;* MOVE THE INJFN
05900		HRR	A,MAP'N			;* THE PAGE TO BE MAPPED
06000		MOVE	B,[400000,,PAG'N]	;* DESTINATION IN CORE
06100		HRLZI	3,100000		;* READ
06200		PMAP
06300		MOVE	B,[-1001,,-1]		;* THE COUNTER
06400		MOVE	A,MAP'N
06500		CAML	A,PGCNT'N		;* SKIP IF NOT LAST PAGE
06600		HRL	B,ODCNT'N		;* COUNT FOR LAST PAGE
06700		AOS	MAP'N			;* INCREMENT PAGE COUNT
06800		POP	P,CH			;* RESTORE AC3
06900		POP	P,A			;* RESTORE THE JFN
07000		POPJ	P,			;* B CONTAINS THE COUNTER
07100	
07200	test'n:	pop	p,a
07300		move	b,[-1,,0]
07400		movem	b,ppnt'n	; skip right away.
07500		setz	b,
07600		ret
07700	
07800	
07900	BPS'N:	0
08000	WRDS'N:	0
08100	CNTS'N:	0
08200	
08300	>
08400	
08500	RDL(1)
08600	RDL(2)
08700	
     
00100	
00200	XPND1:XPND2:TMSG [ASCIZ /
00300	256K is not enough!!!/]
00400		HALT
00500	C4L:	MOVE X,NMATLN
00600		JRST COMPC
00700	
00800	COMP1:	MOVEI X,1
00900	COMPC:	TLNE F,IGC!IGS!IGB!IGU	; WANT TO IGNORE VARIOUS FORMAT CHANGES?
01000		 JRST COMPH		; YES, MUST COMPARE BY BYTE
01100		MOVE D,(A)
01200		XOR D,(B)
01300		ANDCMI D,1
01400		JUMPN D,CPOPJ
01500		MOVE D,(A)
01600		AOS A
01700		AOS B
01800		ANDI D,376
01900		CAIE D,2*32
02000		CAIN D,2*12
02100		SKIPA
02200		JRST COMPC
02300		SOJG X,COMPC
02400		AOS (P)
02500		POPJ P,
     
00100	
00200	COMPH:	TLNN F,IGB		; IGNORE BLANK LINES?
00300		 JRST COMPH1
00400		PUSH P,B		; SAVE ONE POINTER
00500		CALL SKPBL		; SKIP BLANK INES
00600		EXCH A,0(P)		; SAVE THAT AND GET OTHER POINTER
00700		CALL SKPBL
00800		MOVE B,A
00900		POP P,A
01000	COMPH1:	TRO F,SPC1!SPC2		; ASSUME SPACE SEEN
01100		HRLI A,(<POINT 7,0>)	; CONVERT TO BYTE POINTERS
01200		HRLI B,(<POINT 7,0>)
01300		TRO F,TMPF		; FIRST CHARACTER ON LINE
01400	COMPHL:	ILDB C,A		; GET A CHAR FROM ONE STRING
01500		TLNN F,IGS
01600		 JRST COMPHW
01700		CAIE C,40		; SPACE
01800		CAIN C,11		; OR TAB
01900		 JRST [	TROE F,SPC1	; PRECEDED BY SPACE?
02000			JRST COMPHL	; YES, IGNORE IT
02100			MOVEI C,40	; MAKE IT BE SPACE
02200			JRST COMPHY]
02300	COMPHW:	TLNE F,IGC
02400		CAME C,COMNT1
02500		 JRST COMPHY
02600		SKIPGE COMNT2
02700		TRNE F,TMPF
02800		 SKIPA C,COMNT2
02900		 JRST COMPHY		; .F4 AND NOT FIRST CH
03000		JUMPLE C,COMPHZ		; SINGLE CHARACTER COMMENT PREFIX
03100		PUSH P,A
03200		ILDB C,A		; GET SECOND CH
03300		CAME C,COMNT2
03400		 JRST [	POP P,A
03500			LDB C,A
03600			JRST COMPHY]
03700		SUB P,[1,,1]
03800	COMPHZ:	ILDB C,A
03900		CAIE C,12
04000		CAIN C,32
04100		 JRST COMPHY
04200		CAIE C,15
04300		 JRST COMPHZ
04400	COMPHY:	TLNN F,IGU
04500		 JRST COMPHJ
04600		CAIL C,"a"
04700		CAILE C,"z"
04800		SKIPA
04900		 TRZ C,40
05000	; FALLS THRU
     
00100	
00200	; FALLEN INTO
00300	COMPHJ:	ILDB D,B		; GET CHAR FROM OTHER STRING
00400		CAIE D,40		; SOME KIND OF SPACE?
00500		CAIN D,11
00600		TLNN F,IGS		; AND IGNORING SPACING DIFFERENCES?
00700		 JRST COMPHN		; NO, BYPASS THIS
00800		TROE F,SPC2		; SET SPC2 AND SKIP IF WAS NOT SET
00900		 JRST COMPHY		; ALREADY SAW SPACE, GET NEXT CH
01000		MOVEI D,40		; MAKE THIS CH BE SPACE
01100		JRST COMPHP		; AND GO COMPARE CHARACTERS
01200	
01300	COMPHN:	TLNE F,IGC
01400		CAME D,COMNT1
01500		 JRST COMPHP
01600		SKIPGE COMNT2		; .F4?
01700		TRNE F,TMPF		; AND NOT FIRST CH ON LINE?
01800		SKIPA D,COMNT2
01900		 JRST COMPHP		; NOT A COMMENT
02000		JUMPLE D,COMPHO		; SINGLE CHARACTER COMMENT PREFIX
02100		PUSH P,B
02200		ILDB D,B
02300		CAME D,COMNT2
02400		 JRST [	POP P,B
02500			LDB D,B
02600			JRST COMPHP]
02700		SUB P,[1,,1]
02800	COMPHO:	ILDB D,B
02900		CAIE D,12
03000		CAIN D,32
03100		 JRST COMPHP
03200		CAIE D,15
03300		 JRST COMPHO
03400	COMPHP:	TLNN F,IGU
03500		 JRST COMPHK
03600		CAIL D,"a"
03700		CAILE D,"z"
03800		SKIPA
03900		TRZ D,40
04000	COMPHK:	TRZ F,TMPF
04100		CAME C,D
04200		 JRST COMPHD		; CHARACTERS DIFFERENT
04300		CAIE C,12		; LINE FEED OR
04400		CAIN C,32		; EOF?
04500		SKIPA
04600		 JRST COMPHL		; NO, CONTINUE COMPARE
04700		MOVEI A,1(A)
04800		MOVEI B,1(B)
04900		SOJG X,COMPH		; DO ANOTHER LINE
05000		AOS 0(P)
05100		POPJ P,
     
00100	
00200	COMPHD:	TLNN F,IGS		; IGNORE SPACING DIFFERENCES?
00300		 POPJ P,		; NO, GIVE UNEQUAL RETURN
00400		CAIN C,40		; SPACE AGAINST
00500		CAIE D,15		; CR?
00600		 JRST COMPHE		; NO, COMPARE OTHER WAY
00700		ILDB C,A		; YES, GET NEXT CHAR
00800		CAIE C,40
00900		CAIN C,11
01000		 JRST .-3		; CONTINUE UNTIL NON-SPACE
01100		TLNE F,IGC		; IF IGNORE COMMENTS
01200		CAIE C,";"		; AND THIS BEGINS ONE
01300		CAIN C,15		; OR IF THIS IS CR
01400		JRST COMPHL
01500	
01600	COMPHE:	CAIN D,40
01700		CAIE C,15
01800		 POPJ P,
01900		ILDB D,B
02000		CAIE D,40
02100		CAIN D,11
02200		 JRST .-3
02300		CAIE D,15
02400		 POPJ P,
02500		JRST COMPHL
02600	
02700	SKP1L:	TLNE F,IGB		; IGNORE LINE PSACING?
02800		CALL SKPBL
02900	SKP1LA:	MOVE B,0(A)
03000		ANDI B,376
03100		CAIE B,2*32
03200		CAIN B,2*12
03300		AOSA A
03400		AOJA A,SKP1LA
03500		POPJ P,
03600	
03700	SKPBL:	MOVE B,(A)
03800		TRZ B,1
03900		CAMN B,[BYTE(7)15,12,12,12,12]
04000		 AOJA A,SKPBL		; SKIP BLANK LINES
04100		POPJ P,
     
00100	
00200	; GET DEFAULT NAME USING LONG GTJFN TABLE, ERROR RETURN ON BARE CR
00300	GETDNM:	HLRZ 1,DEFFIL		; INPUT JFN
00400		BIN 
00500		CAIN 2,15		; CR?
00600		 JRST [	BIN		; YES.  FLUSH LF
00700			POPJ P, ]
00800		CAIN 2,37		; A CR?
00900		 POPJ P,		; YES GIVE ERROR RETURN
01000		HRLZM 2,GTDNMC		; SAVE THE CHARACTER
01100		MOVEI 1,DEFVER		; POINT TO TABLE
01200		MOVE 2,[POINT 7,GTDNMC,10] ; POINT TO FIRST CHARACTER
01300		GTJFN
01400		POPJ	P,
01500		AOS	0(P)
01600		POPJ	P,
01700	
01800	
01900	GETNAM:	SKIPA 1,[XWD 100002,0]		;* Put this in A and Skip
02000	GETONM:	MOVSI 1,460002 
02100		MOVE 2,PRIMRY			;* From the TTY
02200		GTJFN
02300		POPJ P,				;* +1 return on loss
02400		AOS (P)
02500		POPJ P,				;* Skip return on success
02600	
02700	
02800	RECJFT:	100000,,0
02900		100,,101
03000		0
03100		0
03200		POINT 7,[ASCIZ /RECORDOFLISTINGS/]
03300		0
03400		0
03500		0
03600		0
03700		0
03800		0
     
00100	
00200	PATCH:PAT:BLOCK 30
00300	HDM1:	ASCIZ /1)	/
00400	HDM2:	ASCIZ /2)	/
00500	RMARGN:	IRMRGN
00600	BUFP:	BUF1
00700		BUF2
00800	
00900	LIT
01000	
01100	BZERO:	; START OF AREA TO ZERO ON STARTUP
01200	IFN KL20F,<FRST.: 0>
01300	;;*
01400	PPNT1:	BLOCK	1
01500	PPNT2:	BLOCK	1
01600	PGCNT1:	BLOCK	1
01700	PGCNT2:	BLOCK	1
01800	ODCNT1:	BLOCK	1
01900	ODCNT2:	BLOCK	1
02000	MAP1:	BLOCK	1
02100	MAP2:	BLOCK	1
02200	;;*
02300	LINE1:	BLOCK 1
02400	LINE2:	BLOCK 1
02500	LINCT1:	BLOCK 1
02600	LINCT2:	BLOCK 1
02700	PAGE1:	BLOCK 1
02800	PAGE2:	BLOCK 1
02900	ENDL1:	BLOCK 1
03000	ENDL2:	BLOCK 1
03100	IN1:	BLOCK 1
03200	IN2:	BLOCK 1
03300	INE1:	BLOCK 1
03400	INE2:	BLOCK 1
03500	COMNT1:	BLOCK 1
03600	COMNT2:	BLOCK 1
03700	HDNG:	BLOCK 20
03800	GTDNMC:	BLOCK 1
03900	DEFVER:	BLOCK 1
04000	DEFFIL:	BLOCK 1
04100	DEFDEV:	BLOCK 1
04200	DEFDIR:	BLOCK 1
04300	DEFNAM:	BLOCK 1
04400	DEFEXT:	BLOCK 1
04500		BLOCK 4
04600	CHANGE:	BLOCK 1
04700	RECFCT:	BLOCK 1		; AOBJN WORD TO INDEX RECORD TABLES
04800	RECFPT:	BLOCK NRECF		; STRING POINTERS TO FILE NAMES
04900	RECFVR:	BLOCK NRECF		; VER NUMBERS
05000	RECFST:	BLOCK 4*NRECF		; STRING STORAGE FOR NAMES
05100	BUF1:	BLOCK 1
05200	BUF2:	BLOCK 1
05300	NAM%:	BLOCK 36		;^D30
05400	PDL:	BLOCK NPDL
05500	RECSWB:	BLOCK 1+MAXSWB/5
05600	RECIMG:	BLOCK 1000
05700	VAR
05800	EZERO:	; END OF AREA TO ZERO ON STARTUP
05900	repeat 0,<				;;this blows up fail
06000		IFG <EZERO-<MAPPAG*1000>>,<PRINTX/VARIABLES OVERLAP BUFFERS/>
06100	>;repeat 0
     
00100	
00200		END START
00300	
00400	
00500