	.TITLE	SRCCOM
/
/  EDIT 6		19 OCT 71 - PAUL HENDERSON
			/COPYRIGHT 1969. DIGITAL EQUIP.
			/CORP. MAYNARD, MASS.
IOPS=2			/SRCCOM. DEVICE INDEP SRC COMPARE
IN=0			/W. DESIMONE 1-17-69
ORSLOT=-14		/ORIG FILE INP DAT SLOT
NWSLOT=-15		/NEW FILE INP DAT SLOT
OUT=1
TTYCMD=-2			/.DAT SLOT FOR TT COMMAND INPUT
TTYERR=-12			/.DAT SLOT FOR LST ERROR MESSAGE OUTPUT
TTYCTR=-3	/.DAT SLOT FOR CNTRL TT OUTPUT 
	.IODEV -2,-3,-12,-14,-15
/	PATCH BLOCK ADDED FOR PATCH LOADER
PATCH	.BLOCK 10
INERTF	ERRTTB		/INIT LOC. FOR TT CS BUFF
LSCPLN	LNLBUF		/INIT LOC. FOR LST COMP BUFF
LSCPLI	LNLBUF+1		/INIT LOC. FOR LST CMP STORE
INERTL	ERRTTB+1		/INIT LOC. FOR TT CS BUFF
TAGSET	TAGBUF+1
ORPTIN	BUFFOP+1
NWPTIN	BUFFIP+1
ENDOLD	BUFFOP+0	/PHY. END OF OLD BUFFER
ENDNEW	BUFFIP+0	/PHY. END OF NEW BUFFER
UPBFLM=4000		/UPPER LMT FOR COMP BUFF SIZE
LWBFLM=500		/LOWER LMT FOR COMP BUFF SIZE
TFACTR	0		/TEMP STOR. FOR FACTOR IN DFCTOR RT.
FACTOR	0		/RELOCATION FACTOR
.SCOM=100
INITTF	TTBUF		/INIT. LOC. FOR IN TT BUFF
INITTL	TTBUF+1		/INIT. LOC. FOR IN TT BUFF
TTBFI   TTBUF+2	    /INITIAL TELETYPE BUFFER LOCATION
OUTBFI  BUFFOP+1		  /INIT. COMPARE BUFFER LOCATION
OUTBFS	BUFFIP+1	/SECONDARY COMP. BUFFER
GOSTRT	JMS DFCTOR	/GO DETERM RELOC. FACTOR
	JMS SCOMI	/INIT PTRS TO COMPARE BUFFS
GOSTR1	JMS TTSET
	.INIT TTYCMD,IN,GOSTR1 
	.INIT TTYCTR,OUT,GOSTR1
	JMS COMECH	/GO ECHO 'SRCCOM'
	.EJECT
/COMMAND STRING DECODER DISPATCH TABLE AND KEYBOARD LISTEN
CSREAD	JMS ANGBRK	/GO OUTPUT < CR
	.READ TTYCMD,IOPS,ERRTTB,34
	.WAIT TTYCMD
	LAC TWOLFP	/IN CASE ALTM TERM. TO CS
	JMS CTRSET
	JMS REERBF
	JMS ZDIRBF
NXTONE	JMS GOGET		/CK. FOR CR, NON-PRINT CHAR, AND GET A CHAR
	SAD (15		/IS IT AN (LEFT ARROW)?
	JMP INCSRD
	SAD (137	/YES. GO GET NEW FILE NAME
	JMP NWFLNM
	SAD (115		/NO. IS IT AN M?
	JMP MACSWT	/YES. GO SET MACRO-9 OPTION SW.
	SAD (101		/NO. IS IT AN A?
	JMP ABRSWT	/YES. GO INIT FOR ABBR. OUTPUT
	SAD (103		/IS IT A C?
	JMP ALLSWT	/YES
	SAD (54		/NO. IS IT A COMMA?
	JMP NXTONE	/YES. GET NEXT SWITCH
	SAD (40		/IGNORE SPS
	JMP NXTONE
	.EJECT
/ERROR MESSAGE ROUTINES. THEY RETURN TO APPROPRIATE POINT
ERR1	LAC ERR1PT
	JMS CTRSET
	JMP CSREAD
ERR2	LAC ERR2PT
	JMS CTRSET
	JMP CSREAD
ERR3	LAC ERR3PT
	JMS CTRSET
	JMP CSREAD
ERR4	LAC ERR4PT
	JMS CTRSET
	JMP CSREAD
ERR5	LAC ERR5PT	/INSERTION ERROR OUTPUT
	JMS ERRSET
MOD3M1	NOP	/NOP OR JMS OUTLNL
	JMS LF2		/GEN.2 LF'S
	JMP MOD1AI	/GO OUT TEXT OR NOT
ERR6	LAC ERR6PT	/DELETION ERROR OUTPUT
	JMS ERRSET
MOD3M2	NOP	/NOP OR JMS OUTLNL
	JMS LF2		/GEN. 2 LF'S
	JMP MOD2AD	/GO OUT TEXT OR NOT
ERR7	LAC ERR7PT	/CHANGE ERROR OUTPUT
	JMS ERRSET
MOD3M3	NOP	/NOP OR JMS OUTLNL
	JMS LF2		/GEN. 2 LF'S
	JMP MOD3AC	/OUT TEXT OR NOT
	.EJECT
/ROUTINE TO LOAD ASCII "LOOK AHEAD CAPABILITY EXCEEDED"
/WITH LINE+LOC OR TAG+LOC.
ERR8	LAC (4
	DAC CHRCNT
	LAC* LOCBFE
	DAC TMPST1
	LAC LOCBFE
	DAC DUMPTR	/FOR HANGOV
	ISZ DUMPTR
	LAC* DUMPTR
	AND (777400		/MASK 1ST 2 CHAR
	DAC TMPST2
	LAC (-1
	DAC FIRCNT
	LAC LOCBFE
	DAC BUFFPT
	ISZ LASCNT
	ISZ LASCNT
	JMS TRANSF
	LAC ERR8PT
	JMS CTRSET
	LAC (JMS CTRSET
	DAC OUTLNL+2
	JMS OUTLNL	/GO OUTPUT LK-AH CAP EXC ON CTR DEV
	LAC (JMS ERRSET
	DAC OUTLNL+2	/REINIT FOR ERR MESSGS
	JMS TTSET
	JMP EXITBK
	.EJECT
ERR9	LAC ERR9PT	/FILES NOT PRESENT ERROR MESS
	JMS CTRSET
	JMP CSREAD
ERR11	LAC ER11PT	/END OF INPUT FILES REACHED
	JMS CTRSET
	JMS TTSET
	JMP EXITBK
ERR12	LAC ER12PT	/PROGRAMS IDENTICAL
	JMS CTRSET
	JMP EXITBK+3
ERR20	LAC ER20PT
	JMS CTRSET
	.EXIT
LF2	0		/GEN TWO LF'S
	LAC TWOLFP
	JMS ERRSET
	JMP* LF2
	.EJECT
/ROUTINE TO CALCULATE AVAIL. CORE FOR COMPARE BUFFERS .DEFINES
/RELOC. FACTOR AND BUFFER POINTERS. BACK TO MONITOR IF LESS THAN LWBFLM
/LOCS AVAIL. ALLOWS MAXIMUM OF UPBFLM LOCS ALLOTMENT.
/	ONCE ONLY CODE
ERRTTB=.
/	TT BUFFER FOR COMMAND STRING INPUT
SCOMI	0		/ROUT. TO INIT COMP PTRS
	LAC* (.SCOM+2
	TAD (1
	DAC ORPTIN
	DAC OUTBFI
	TAD FACTOR
	TAD (1
	DAC ENDOLD
	TAD (2
	DAC NWPTIN
	DAC OUTBFS
	TAD FACTOR
	TAD (1
	DAC ENDNEW
	JMP* SCOMI
DFCTOR	0		/ROUT. TO CALC. AVAIL. CORE
	LAC* (.SCOM+2	/FOR COMP BUFFS
	CMA
	TAD (1
	TAD* (.SCOM+3
	DAC TFACTR
	AND (1		/DETERM IF ODD OR EVEN DIFF
	SNA
	JMP EVEN
	LAC TFACTR
	TAD (-1
	SKP
EVEN	LAC TFACTR
	CLL
	RAR
	DAC FACTOR
	TAD (-UPBFLM
	SPA
	JMP .+3
	LAC (UPBFLM
	DAC FACTOR
	LAC FACTOR
	TAD (-LWBFLM
	SPA
	JMP ERR20
	LAC FACTOR
	TAD (-3		/ALLOW FOR EXTRA LOCS
	DAC FACTOR
	JMP* DFCTOR
	.EJECT
ANGBRK	0		/OUTPUT < CR
	LAC ANGBPT
	JMS CTRSET
	JMP* ANGBRK
COMECH	0		/OUTPUT SRCCOM
	LAC COMPTR
	JMS CTRSET	/GO OUTPUT TO CONTROL DEVICE
	JMP* COMECH
LNDFF	0
	ISZ ZSW		/SET 0 SUPPRESS FOR 0 TO SP
	ISZ TAGSW
	DAC BUFFPT
	LAC CHNGCN
	SNA
	LAC DIFFCN
	JMS CVINIT
	JMS RESET
	DZM TAGSW
	DZM ZSW
	JMP* LNDFF
LFCRPK	0		/ROUT. TO GEN AND PACK
	LAC (12		/LF AND CR IN 5/7 ASCII
	DAC CHAR
	JMS TAGPAK
	LAC (15
	DAC CHAR
	JMS TAGPAK
	JMP* LFCRPK	/EXIT
FIXLCT	0		/ROUT. TO CORRECT LOC. CNT
	LAC INLASW
	SZA		/ON AN INSERTION?
	JMP INSCOR	/YES.
	LAC CHLASW
	SZA
	JMP CHGCOR
	LAC LOCCNT	/NO
	TAD DIFFCN	/ADD # OF DIFF LINES
	TAD VRFNUM		/ALLOW FOR REMATCH FACTOR
	DAC LOCCNT
	JMP* FIXLCT
INSCOR	LAC LOCCNT	/NO.  ADD REMATCH FACTOR
	TAD VRFNUM
	DAC LOCCNT
	JMP* FIXLCT
CHGCOR	LAC LOCCNT
	TAD CHNGCN
	DAC LOCCNT
	ISZ LOCCNT
	JMP* FIXLCT
	.EJECT
/SWITCH SETTING ROUTINES. NWFLNM PICKS UP NEW FILENAME.
/OUTPUT ROUTINES TO LISTING AND CONTROL DEVICE
MACSWT	LAC MSW1		/LOAD JMS TAGCHK
	DAC MOD1M
	LAC MSW3ON
	DAC MOD2M
	JMS LINMOD
	JMP NXTONE
ABRSWT	LAC ASW1ON	/SET ABBREV. OUTPUT SW
	DAC MOD1AI
	LAC ASW2ON
	DAC MOD2AD
	LAC ASW3ON
	DAC MOD3AC
	JMP NXTONE	/CONTINUE
ALLSWT	LAC CSW1ON
	DAC NXTCHR
	JMP NXTONE
NWFLNM	JMS GOGET
	SAD (15
	JMP INCSRD	/GO INIT FOR ANOTHER CS READ
	SAD (57		/IS IT A SLASH?
	ISZ WHFLSW	/YES.
	SAD (40		/NO. IS IT A SP?
	JMP NWFLNM	/YES. IGNORE SPACES.
	JMP FILSTR	/NO. GO STORE FILENAME+EXT.
LINMOD	0		/SET MODULES FOR 
	DAC MOD3M1
	DAC MOD3M2	/JMS OUTLNL OR NOP
	DAC MOD3M3
	JMP* LINMOD
OUTPUT	0		/ROUTINE TO OUTPUT ERR. MESSAGES
	.WRITE TTYERR,IOPS,ERR1BF,52
	.WAIT TTYERR
	JMP* OUTPUT
OUTCTR	0		/ROUT. TO OUTP TO CNTRL DEV
	.WRITE TTYCTR,IOPS,COMBUF,34
	.WAIT TTYCTR
	JMP* OUTCTR
	.EJECT
/ROUTINES CONCERNED WITH COMMAND STRING DECODING.
OUTLNL	0	/ROUT. TO OUTPUT LAST LINE BEFORE MOD
	LAC LSCPLN	/LOAD LNLBUF
	JMS ERRSET	/OUTPUT LAST LINE BEF MOD
	JMP* OUTLNL
SPCOLN	0		/ROUTINE TO CHK FOR SPOC: CHAR IN AC
	SAD (40		/IS IT A SP?
	JMP GETEXT	/YES. GO GET EXT.
	SAD (72		/NO. IS IT A :?
	JMP GETEXT	/YES. GO GET EXT.
	JMP* SPCOLN	/NO. EXIT
SXSETR	0		/ROUT TO INIT FOR SIXBIT PACK.
	DAC SIXPTR	/ENTERS WITH AC CONTAINING INIT PTR.
	LAC CHAR		/RELOAD ASCII CHAR
	JMP* SXSETR	/EXIT
GOGET	0		/ROUTINE TO CHK FOR CR,NON-PRINT CHAR,
REGET	JMS GETCHR
	SAD (15		/DON'T IGNORE CR'S
	JMP* GOGET
	SAD (11		/DON'T IGNORE TABS
	JMP* GOGET
	SAD (175	/DON'T IGNORE ALTMODES
	JMP REGET1	/CHANGE TO CR
	JMS NONPTR
	JMP* GOGET
REGET1	LAC (15	/MAP ALTMODE TO CR
	DAC CHAR	/MODIFY CHAR HOPPER
	JMP* GOGET
SETPKG	0		/ROUT. TO RESET PKCNTR, BUMCTR,AND
	LAC (-7
	DAC PKCNTR
	LAC (-3
	DAC BUMCTR
	DAC SHWFCT
	LAC (JMS SPCOLN		/INIT FOR NON-SP-IGNORE
	DAC SIXPAK+5
	DZM WHFLSW
	JMP* SETPKG
NONPTR	0		/CHECK FOR NON-PRINTING CHARS
	TAD (-100		/IS 7-BIT ASCII LESS THAN 300
	SMA		/?
	JMP OUT337	/NO CONTINUE
	TAD (40		/YES
	SMA		/IS IT OUT OF (240,277)?
	JMP LOADUP	/NO CONTINUE
	JMP REGET	/YES  IGNORE
OUT337	TAD (-40
	SPA		/IS IT GREATER THAN 337?
	JMP LOADUP	/NO
	JMP REGET	/YES.  IGNORE
LOADUP	LAC CHAR		/RELOAD CHAR
	JMP* NONPTR	/CONTINUE
	.EJECT
ZDIRBF	0		/ROUT. TO ZERO DIR. BUFFS
	LAC ZLOCST
	DAC ZPNTR	/SET PTR FOR ZEROING ORGDBF
ZAGAN1	ISZ ZPNTR
	LAC ZPNTR
	SAD COMLOC	/AT THE COM EXT?
	JMP* ZDIRBF	/YES. EXIT
	DZM* ZPNTR
	JMP ZAGAN1	/NO.  CONTINUE
	.EJECT
/ROUTINES TO CONTROL COMPARE BUFFER FILLS AND REFILLS
/ALSO A REDEFINING ROUTINE REERBF
NXLSET	LAC INPSW
	SNA		/IS IT ON?
	JMP CHRDOR	/GO GET ANOTHER LINE I  OR BUFF
	JMP CHRDNW	/GO GET ANOTHER LINE IN NEW BUFF
INTCMP	LAC INPSW
	SZA		/IS IT ON?
	JMP STRCOM	/GO START COMPARE
	JMP INT2FL	/NO  GO INIT FOR SEC BUFF FILL
INT2FL	LAC LDPTNW
	DAC BUFFPT	/SET BUFFPT OT LDPTNW
	ISZ INPSW		/SET INPSW FOR 2-BUFF FILL
	JMP CHKFUL
CHRDOR	LAC OROVER
	SZA		/IS OLD FILE DONE?
	JMP INT2FL	/YES.  DON'T REFILL
	JMP READOR	/NO  REFILL
CHRDNW	LAC NWOVER
	SZA		/IS OLD FILE DONE?
	JMP STRCOM	/YES.  DON'T REFILL
	JMP READNW	/NO  REFILL
ORSET	0		/SET LDPTOR
	LAC BUFFPT
	DAC LDPTOR
	JMP* ORSET
NWSET	0		/SET LDPTNW
	LAC BUFFPT
	DAC LDPTNW
	JMP* NWSET
REERBF	0		/ROUT. TO INIT GETCHR ROUT AND SWITCHES
	JMS SETDEF	/SET DEFAULT CONDS.
	JMS SETPKG
	LAC INERTF	/LOAD ERRTTB
	DAC BOFFPT	/SET 1ST HALF WP PTR
	LAC INERTL	/LOAD ERRTTB+1
	DAC BUFLPT	/SET LAST HALF UP PTR.
	LAC (-1
	DAC CARCNT	/RESET FOR GETCHR ROUTINE
	JMP* REERBF	/EXIT
	.EJECT
/MORE COMMAND STRING DECODING ROUTINES. ALSO ROUTINES
/ERRSET AND CTRSET TO INIT LISTING AND CMD. STR. ERR. MSGS.
TRIM	0		/TRIM OFF 2 BITS ROUTINE
	AND (77
	DAC DIRSTR	/STORE CHAR TRIMMED
	JMP* TRIM
SBCHRS	0		/SIXBIT CHAR STORE ROUT.
	TAD* SIXPTR	/STORE IN PROPER DIR. BUFFER
	CLL
	ISZ SHWFCT	/INCREM. SHIFT-WORD-FILL-CNTR
	JMP .+2		/NOT ZERO
	JMP NXTSIX	/IS ZERO.  GO GET NEXT WORD
	RTL; RTL; RTL	/ROT SIX LEFT
	DAC* SIXPTR	/RESTORE
	JMP* SBCHRS	/RETURN
NXTSIX	DAC* SIXPTR	/RESTORE
	ISZ BUMCTR	/INCREM. PTR. BUMP CNTR.
	ISZ SIXPTR	/BUMP PTR. TO NEXT WORD
	LAC (-3
	DAC SHWFCT	/RESET
	JMP* SBCHRS	/EXIT
ERRSET	0		/ROUT. TO INIT .WRITE
	DAC OUTPUT+3	/SET .WRITE PTR.
	JMS OUTPUT	/GO OUTPUT
	JMP* ERRSET	/RETURN
CTRSET	0		/ROUT TO INIT WRITE
	DAC OUTCTR+3	/INIT CORRECT BUFFER TAG
	JMS OUTCTR	/GO OUTPUT
	JMP* CTRSET
INCSRD	LAC ORGDBF	/CHK ORG. FILE BUFF
	SNA		/IS IT 0?
	JMP ERR3		/YES
	LAC NEWDBF	/CHK NEW FILE BUFF
	SNA		/IS IT 0?
	JMP ERR3	/YES
	LAC ORGDBF+2	/IS ORG. EXT COM?
	SAD ISACOM	/COMP WITH 031715
	JMP ERR4		/YES
	LAC NEWDBF+2	/IS NEW EXT COM?
	SAD ISACOM	/COMP WITH 031715
	JMP ERR4		/YES
	JMS LSTFIL		/GEN LST FILENAME
	JMP RESTRT	/NO.  BOTH FILES SPECIFIED
IGNSPA	0		/ROUT. TO IGNORE SPACES
IGAGAN	SAD (40
	JMP SIXPAK
	JMP* IGNSPA
LSTFIL	0		/ROUT. TO SET LST DEV FILE+EXT
	LAC ORGDBF
	DAC OUTDBF
	LAC ORGDBF+1
	DAC OUTDBF+1
	JMP* LSTFIL
	.EJECT
EXTBCK	JMS LEFTJS
	JMS SETPKG	/RESET PTRS
	ISZ WHFLSW	/SET WHICH FILE SW
	JMP NWFLNM	/GO STORE NEXT FILE NAME + EXT
FILSTR	LAC WHFLSW
	SZA		/IS SW ON?
	JMP ORIGPK	/YES. ON ORIG FILE STORE
	JMP NEWPK		/NO. ON NEW FILE STORE
ORIGPK	LAC ORGDIT
	JMS SXSETR	/GO INIT FOR STORE OF OLD FILE NAME
	JMP SIXPAK+1		/GO PACK IN SIXBIT ASCII
NEWPK	LAC NEWDIT
	JMS SXSETR		/GO INIT FOR STORE OF NEW FILENAME
	SKP
SIXPAK	JMS GOGET		/GO PACK IN SIXBIT ASCII
	SAD (15
	JMP INCSRD
	SAD (57		/IS IT A SLASH?
	JMP EXTBCK	/YES. GO GET NEXT FILE NAME + EXT.
	JMS SPCOLN	/IS IT A SP OR COLON? GO INIT GETEXT IF YES.
	ISZ PKCNTR	/MORE THAN 6 CHARS IN FILE NAME OR 3 IN EXT.
	SKP		/NO
	JMP ERR2		/GO OUTPUT ERROR # 2 MESSAGE
	JMS TRIM		/NO. GO TRIM TO SIXBIT
	JMS SBCHRS	/GO STORE SIXBIT CHAR.
	JMP SIXPAK
GETEXT	JMS LEFTJS
	LAC BUMCTR	/INIT -3
	CMA
	TAD SIXPTR	/SET PTR TO WORD 2 OF BUFF
	DAC SIXPTR
	LAC (-4
	DAC PKCNTR
	LAC (-3
	DAC SHWFCT
	LAC (JMS IGNSPA
	DAC SIXPAK+5	/INIT FOR SP-IGNORE
	JMP SIXPAK	/GO GET ANOTHER CHAR.
LEFTJS	0		/ROUT. TO LEFT JUST. FILENAME
	LAC SHWFCT
	SAD (-3		/IS IT THREE
	JMP* LEFTJS	/YES
	SAD (-1
	JMP* LEFTJS
JSAGAN	CLL		/NO.  LEFT JUST
	ISZ SHWFCT
	SKP
	JMP* LEFTJS	/DONE
	LAC* SIXPTR	/NOT DONE
	RTL; RTL; RTL
	DAC* SIXPTR	/RESTORE
	JMP JSAGAN	/REPEAT
	.EJECT
/INIT I/O DEVICES FOR INPUT. CHK FILE PRESENCE VIA .FSTAT
/ALSO .ENTER LST. DEVICE FILENAME (ORIG FILENAME + "COM" EXT.)
RESTRT	JMS TTSET
	.INIT ORSLOT,IN,GOSTR1
	.INIT NWSLOT,IN,GOSTR1
	.FSTAT ORSLOT,ORGDBF
	SNA
	JMP ERR9
	.SEEK ORSLOT,ORGDBF
	.FSTAT NWSLOT,NEWDBF
	SNA
	JMP ERR9
	.SEEK NWSLOT,NEWDBF
	.INIT	TTYERR,OUT,GOSTR1  /INITIALIZE LISTING DEVICE HERE
	.ENTER TTYERR,OUTDBF
	JMS CPINFO		/OUT. CS ON LST DEV
	LAC TWOLFP	/INCASE ALTM. TERM TO CS
	JMS ERRSET
	JMP CHKFUL
	.EJECT
/INPUT FILES TO BE COMPARED. CHECK FOR VALID DATA AND ASCII MODE.
/DISPATCH TO PROPER ROUTINES. MOD2M+1 TO LINEOV-1 EXECUTED IF
/M SWITCH ON.
READOR	.READ ORSLOT,IOPS,TTBUF,52
	.WAIT ORSLOT
	JMP NOMORE		/SKIP OVER READNW
READNW	.READ NWSLOT,IOPS,TTBUF,52
	.WAIT NWSLOT
NOMORE	JMS ENOFMD
	JMS BINDAT		/CHK FOR IMPROPER DATA
	JMS DATERR	/CHK FOR PROPER DATA READ
NXTCHR  JMS GETCHR	    /JMS GOGET OR JMS GETCHR
	ISZ	ALLCNT	/>126 CHARS IN?
	SKP		/NO
	JMP	ERR16	/YES. OUTPUT BAD DATA
MOD2M	JMP ASPACK	/JMP ASPACK OR NOP
        LAC CHAR	    /LOAD CHAR. INTO AC
        SAD (57	    /IS IT A /?
        JMP SLASHF	    /GENERATE A CR AND STORE
        SAD (15	    /CR?
        JMP LINEOV	    /STORE IN COMP. BUFFER IN 5/7 ASC.
        SAD (12	    /LF?
        JMP NXTCHR	
        SAD (11	    /TAB?
        SKP
        SAD (40	    /SPACE?
        JMP SPTAB	    /GO TO SP-TAB ROUTINE CONVERSIONS
        JMP INPACK	    /GO INITIALIZE FOR PACKING 5/7
LINEOV	DZM PKCNT
	JMP ASPACK
	.EJECT
/SPTAB AND SLASHF ROUTINES EXECUTED IF M SWITCH ON. IN ANY
/EVENT DISPATCH TO CORRECT SHFT ROUTINES FOR 5/7 ASCII PACK.
/ASPACK ENTERED VIA TAGPAG IF OTHER THAN INPUT IS TO BE STORED.
SPTAB   LAC LA	    /TEST LOOK AHEAD SWITCH.
        SZA	    /IF AC NOT =0, ON A LOOK AHEAD
        JMP NXTCHR	       /GO GET ANOTHER CHAR.
        LAC SW	    /FIRST SP OR TAB IN THE LINE?
        SNA	    /YES IF 0.
        JMP .+3	    /IF 0, SET T-T AND SP-T
        LAC (40	    /IF NOT 0, SET T-SP AND SP-SP
        SKP
	LAC (11		/SET T-T AND SP-T
        DAC CHRTMP	  /STORE CHAR TEMPORARILY
	CLL
        ISZ LA	    /SET LA SWITCH TO NON 0
        JMP NXTCHR	    /GET ANOTHER CHAR.
CRSTOR  LAC (15	    /GEN. AND STORE CR SINCE / FOUND
	DAC CHAR
	DZM PKCNT
        JMP ASPACK	       /GO PACK THE CR
SLASHF	LAC LA
	SZA		/IN LOOK-AHEAD MODE?
	JMP CRSTOR 	/YES.  IGNORE COMMENT
	LAC CHR
	SAD (15		/LAST STORED CHR A CR?
	JMS RESET	/YES.  IGNORE COMMENT
	JMP ASPACK	/NO.  STORE SLASH AS DIV. SIGN
INPACK  LAC LA	    /CHECK LOOK AHEAD SWITCH
        SNA	    /SKIP IF ON AN AHEAD LOOK
        JMP ASPACK	       /AC = 0. NOT ON A LA
        ISZ PKCNT	    /ALLOW TO PACK TWO CHARS.
        LAC CHRTMP	   /PACK T OR SP FIRST
        DAC CHR	   /LOAD INTO CHAR. HOPPER
	JMP .+4
TAGPAK	0		/TAG STORE ROUT.
ASPACK	LAC CHAR
	DAC CHR		/LOAD CHAR. INTO CHAR. HOPPER
	LAC CHRCNT	/CHECK CHAR. CNT
        SAD (5
	DZM CHRCNT
	LAC CHRCNT
        SAD (0	    /DISPATCH TO VARIOUS PACK ROUTINES
        JMP CHAR1
        SAD (1
        JMP CHAR2
        SAD (2
        JMP CHAR3
        SAD (3
        JMP CHAR4
        SAD (4
        JMP CHAR5
        HLT	    /ERROR!
	.EJECT
CHKEXT  ISZ CHRCNT	    /ALLOW FOR NEXT PACK
	LAC TAGSW
	SZA
	JMP* TAGPAK
        LAC PKCNT	    /CHECK TO SEE IF PKCNT IS 0
        SNA
        JMP CRCHK	   /YES
        DZM PKCNT	    /NO.REZERO COUNT
	ISZ SW		/SET FIRST SP,T SWITCH
	DZM LA		/RESET LA SWITCH
        JMP ASPACK	    /GO PACK IT
CRCHK	LAC CHR
	SAD (15		/IS IT A CR?
	JMP LOAD	/YES
	LAC TAGSW		/LOAD TAG STORE SW
	SZA		/IS IT ON?
	JMP* TAGPAK	/YES
	JMP NXTCHR	/NO. LINE NOT OVER
RESET	0		/REINIT. GETCHR PTRS. ETC.
	LAC INITTF
	DAC BOFFPT	/RESET IN TT BUFF POINTER
	LAC INITTL
	DAC BUFLPT	/RESET LAST WORD POINTER
	LAC	(-176
	DAC	ALLCNT	/REINIT CHAR. COUNT.
	DZM CHRCNT
	LAC (-1
	DAC CARCNT	/REINT. FOR GETCHR ROUT.
	LAC  TAGSW	/LOAD TAG STORE SW
	SZA		/IS IT ON?
	JMP* RESET	/YES
	JMP CHKFUL
ENOFMD	0		/ROUT. TO CHK FOR EOF OR EOM
	LAC TTBUF
	DAC TPTTBF
	LAC TPTTBF
	AND (17		/MASK BITS 14-17
	SAD EOM		/AT END OF MEDIUM?
	JMP ALLDON	/YES
	SAD EOF		/AT END OF FILE?
	JMP FINE	/YES
	JMP* ENOFMD
BINDAT	0		/ROUT. TO CHK FOR IOPS ASCII DATA
	LAC TTBUF
	AND (17
	SAD IOPASC	/IS IT IOPS ASCII DATA?
	JMP* BINDAT	/YES.  CONT
ERR10	LAC ER10PT	/NO.  OUTPUT ERR AND GET ANOTHER CS
	ISZ ALIKE
	JMS CTRSET
	JMS TTSET
	JMP EXITBK	/GO .CLOSE AND GOSTRT
	.EJECT
DATERR	0		/ROUT TO CHK FOR GOOD DATA READ
	LAC TPTTBF	/LOAD HEADER 0
	AND (60		/MASK VALIDITY BITS
	SNA		/ARE THEY 0?
	JMP* DATERR	/YES.  DATA READ OK
ERR16	ISZ ALIKE		/PREVENT EQUI-FILES WRITE
	LAC ER16PT	/NO.  GO OUTPUT ERR MESG# 16
	JMS CTRSET
	JMS TTSET
	JMP EXITBK
ALLDON	JMS RINTTY	/RESET HEADER 0
	LAC INPSW
	SZA	/IS IT 0?
	JMP .+4		/NO
	LAC ER13PT	/YES. OUTP 'END OF NEW SRC'
	JMS CTRSET
	JMP QMORE	/EXM. IF MORE INP DESIRED
	LAC ER14PT	/OUTP 'END OF ORIG SRC'
	JMS CTRSET
	JMP QMORE
FINE	JMS RINTTY
	LAC INPSW
	SZA		/IS IT 0? AT END OF ORIG FILE?
	JMP .+3		/NO.  IS 1 AND AT END OF NEW FILE
	ISZ OROVER	/SET LAST FILL SW FOR ORIG BUFF
	SKP
	ISZ NWOVER	/SET LAST FILL SW FOR NEW BUFF
	JMP INTCMP	/EXIT
QMORE	LAC (JMP QMORA+1
	DAC NXTONE+1	/FOR REENTRY TO QMORE
	LAC (NOP
	DAC REERBF+1
	DAC NXTONE-1
QMORA	JMP CSREAD	/GO READ COMMAND
	SAD (131		/Y OR YES?
	JMP VALCK1	/YES.  EXIT AND CONT.
	SAD (116		/N OR NO?
	JMP VALCK2	/YES.  GO SET SWTS
	LAC ER15PT
	JMS CTRSET	/GO OUTPUT '?'
	JMP QMORA	/AGAIN
VALCK1	JMS GOGET	/GET CHR AND AVOID NONPTRS
	SAD (15		/A CR?
	JMP RVAL1	/YES  COMMAND OK
	JMP QMORA+5	/NO BAD COMMAND
VALCK2	JMS GOGET
	SAD (15
	JMP RVAL2	/SET END OF FILES SWS
	JMP QMORA+5	/BAD COMMAND
	.EJECT
RINTTY	0		/RESET HEADER 0
	SAD EOM		/IS IT A 6?
	JMP ASIX		/YES
	LAC TTBUF	/NO
	TAD (-3
	TAD (32000
	DAC TTBUF
	JMP* RINTTY
RVAL1	ISZ TAGSW
	JMS RESET
	DZM TAGSW
	JMP XRDLIN
RVAL2	ISZ TAGSW
	JMS RESET
	DZM TAGSW
	JMP FINE+1
ASIX	LAC TTBUF
	TAD (-4
	TAD (32000
	DAC TTBUF
	JMP* RINTTY
XRDLIN	LAC INPSW
	SZA
	JMP READNW
	JMP READOR
	.EJECT
/ASCII 5/7 PACK SHFT ROUTINES. ALSO LEAD INTO STORING
/ROUTINE WHICH FILLS COMPARE BUFFERS
CHAR1	JMS ATEND
	ISZ BUFFPT	/POSITION BUFFER POINTER
        LAC CHR
        CLL
        RTR; RTR; RTR; RTR	  /R SHFT. 8
        JMP STORE
CHAR2   LAC CHR
        CLL
        RTL; RTL;	     /SHIFT FOUR LEFT
        JMP STORE
CHAR3   LAC CHR
        RTR; RAR	    /RIGHT SHFT. 3
        AND (17	    /MASK BITS 14-17
        ISZ HANGOV	    /SET OVER HANG SWITCH
        JMP STORE
LFTOVR  LAC CHR
        CLL
        RTR; RTR	    /RIGHT SHFT. 4
        AND (700000     /MASK BITS 0-2
        JMP STORE
CHAR4   LAC CHR
	CLL
        RTL; RTL; RTL; RTL;	        /LEFT SHFT. 8
	AND (77400	/MASK BITS 3-9
        CLL
        JMP STORE
CHAR5   LAC CHR
        CLL
        RAL
	AND (376
STORE	DAC HOLD
	ISZ FIRCNT	/SET WORD ONE CHR. CNT		
	JMP GEN1	/GO TEMP. LOAD WORD ONE
	LAW 17777	/SET FIRCNT FOR REENTRY INTO GEN2
	DAC FIRCNT
	JMP GEN2		/GO TEMP. LOAD WORD 2
	.EJECT
/REMAINING PORTION OF 5/7 STORING ROUTINE. CR IS LAST CHAR.
/STORED IN ANY WORD. BITS FOLLOWING CR ARE 0. BUFFERS ARE
/CIRCULAR AND POINTER RUNAWAY PREVENTED BY ATTEND ROUT.
/BUFFPT HAS MULT. DEFINITIONS DEPENDING ON WHERE CHARS. STORED.
GEN1	LAC TMPST1
	TAD HOLD
	DAC TMPST1		/STORE WORD 1 TEMP. IN TMPST1
	LAC HANGOV
	SNA		/IN A HANGOVER?
	JMP CHKEXT		/NO
	DZM HANGOV	/YES. RESET HANGOVER SWITCH
	JMP LFTOVR
GEN2	LAC TMPST2
	TAD HOLD
	DAC TMPST2	/STORE WORD 2 TEMP. IN TMPST2
	ISZ LASCNT	/SET CHR. CNT FOR WORD 2
	JMP CHKEXT
LOAD	LAC TMPST1	/LOAD COMP. BUFF-CR OR WP FILL
	DAC* BUFFPT
	LAC TMPST2
	SNA	/IS WORD 2 EMPTY?
	JMP STORNO	/YES.  DON'T STORE IT
	JMS ATEND
	ISZ BUFFPT	/NO.  STORE IT IN NEXT WORD
	LAC TMPST2
	DAC* BUFFPT
STORNO	DZM TMPST1	/RESET TEMP. STORAGE WORDS TO ZERO
	DZM TMPST2
	LAW 17774
	DAC FIRCNT	/RESET WORD 1 COUNTER
	LAW 17775
	DAC LASCNT	/RESET WORD 2 COUNTER
	LAC CHR
	SAD (15	/IS LAST CHAR. A CR?
	JMS RESET	/YES.  REINIT. AND GET ANOTHER LINE
	JMP CHKEXT	/NO.  FILL ANOTHER WP
ATEND	0		/ROUT. FOR CHK PHY END OF BUFF
	LAC BUFFPT
	SAD ENDOLD
	JMP SETOLD
	SAD ENDNEW
	JMP SETNEW
	JMP* ATEND
SETOLD	LAC OUTBFI
	DAC BUFFPT
	JMP* ATEND
SETNEW	LAC OUTBFS
	DAC BUFFPT
	JMP* ATEND
	.EJECT
/5/7 ASCII UNPACK ROUTINE. LEAVES WITH 7-BIT ASCII CHAR
/RIGHT JUSTIFIED IN AN OTHERWISE ZERO AC.
GETCHR  0 	    /GET CHAR ROUTINE. INTO BITS 11-17
AGAN    ISZ CARCNT	    /INITIALLY -1
        JMP NUCHAR	    /CURRENT 5/7 PAIR NOT EXHAUSTED
	JMS ATENDL
	ISZ BUFLPT	/RESET LAST HALF POINTER
	JMS ATENDL
	ISZ BUFLPT
NUPAIR  LAC* BUFLPT      /SKIP HEADERS
        DAC LSTHAF	   /STORE LASTHALF OF WP
        LAW 17773		  /GO THRO SHIFT LOOP
        DAC CARCNT	
	JMS ATENDF
	ISZ BOFFPT	/RESET FIRSTHALF POINTER
	JMS ATENDF
	ISZ BOFFPT
        LAC* BOFFPT      /POINTER FOR FIRST HALF OF WP
        DAC FSTHAF	   /STORE FIRST HALF OF WP
NUCHAR  LAW 17770	    /GO THRO SHIFT LOOP
        DAC TEMP1	   /7 AND 1/2 TIMES
GETBCK  LAC LSTHAF	    /LOAD LAST HALF
        RAL	    /LEFT SHFT. ONE
        ISZ TEMP1	    /SET SHFT. COUNTER
        JMP GETMRE	    /NOT THRO SHIFTING YET
        AND (177	    /CHAR. IN POSITION.MASK BITS 11-17
        DAC CHAR	   /DEPOSIT INTO CHAR. HOPPER
        JMP* GETCHR
GETMRE  DAC LSTHAF	    /STORE SHIFTED LAST HALF
        LAC FSTHAF	    /LOAD FIRST HALF
	RAL		/LEFT SHFT ONE
        DAC FSTHAF
        JMP GETBCK
	.EJECT
/ROUTINES TO DETERMINE IF THERE IS SP AVAIL. IN COMPARE
/BUFFERS FOR REFILLING. THERE IS A 52 WORD LOWER LIMIT.
CHKFUL	DZM SW
	DZM LA
	LAC INPSW
	SNA		/IS IT NON-ZERO?
	JMP CHKOR	/NO, IT IS ZERO.
CHKNW	JMS NWSET
	LAC LDPTNW
	CMA
	TAD (1		/TWO'S COMPLEMENT OF LOAD PTR.
	TAD DONNPT
	SPA
	JMS ADDSET
	JMP LINECH
CHKOR	JMS ORSET
	LAC LDPTOR
	CMA
	TAD (1
	TAD DONOPT
	SPA
	JMS ADDSET
LINECH	TAD (-64
	SPA
	JMP INTCMP
	JMP NXLSET	/NOT FILLED
ADDSET	0
	TAD FACTOR	/ADD ON RELOCATION FACTOR
	JMP* ADDSET
	.EJECT
/BLK. TRANS ROUTINE FROM COMPARE BUFFERS TO LINE BUFFERS.
/END OF LINE DETERMINED BY WORD CONTAINING CR FOLLOWED BY
/TRAILING ZERO BITS.
INITBT	0		/BLK. TRANS. ROUT
	LAC INLASW
	SZA		/IS IT ON?
	JMP PTRSTI	/YES. GO SET INIT PTR. FOR I OUT
	LAC DLLASW
	SZA		/IS IT ON?
	JMP PTRSTD	/YES. GO SET INIT PTR FOR D OUT
	LAC CHLASW
	SAD (2		/IS OLD BUFFER CALLING?
	JMP PTRSTD	/YES
	SAD (1		/NO. IS NEW BUFF. CALLING?
	JMP PTRSTI
	SKP	/BLOCK TRANS LAST LINE BEFORE LAST COMP
PTRSTD	LAC ORLSTM	/LOAD LAST COMP BEFORE DEL.
	DAC BUFFPT	/SET BEGINNING LOC. OF TRANS
	JMP STCHK-2
PTRSTI	LAC NWLSTM	/LOAD LAST COMP  BEFORE INSERT.
	DAC BUFFPT	/SET BEGINNING OF LOC. TRANS
	JMP STCHK-2
	LAC INPSW		/LOAD SEC. INP. SW
	SZA		/IS SW 0?
	JMP SECINT	/NO
	LAC OUTBFI	/YES.  RESET PTS. FOR PRIM. BUFF
	DAC BUFFPT
	JMP .+3
SECINT	LAC OUTBFS	/RESET PTS. FOR SEC. BUFF
	DAC BUFFPT
	JMS ATEND
	ISZ BUFFPT	/SET BUFF POINTER TO BUFFOP+2
STCHK   LAC* BUFFPT
        AND (774000     /MASK BITS 0-6
        XOR (64000	    /ZERO AC IF CR IN BITS 0-6
        SNA
        JMP TERMTR	    /YES. TERMINATE TRANSFER
        LAC* BUFFPT
        AND (3760	    /MASK BITS 7-13
        XOR (320	    /ZERO AC IF CR IN BITS 7-13
        SNA
        JMP TERMTR	    /YES
        LAC* BUFFPT
        AND (17	    /MASK BITS 14-17
        XOR (1	    /ZERO AC IF BITS 14-17 ARE 0001
        SNA
        JMP CHKNXT	    /YES. GO CHECK NEXT WORD
	LAC* BUFFPT	/LOAD WORD 1
	JMS STRTTB	/GO STORE WORD 1
	JMS ATEND	/CHK FOR PHYS END OF BUFF
	ISZ BUFFPT	/SET POINTER TO WORD 2
	.EJECT
NOTERM  LAC* BUFFPT     /CR NOT IN OVER HANG
        AND (77400	    /MASK BITS 3-9
        XOR (6400	    /ZERO AC IF CR IN BITS 3-9
        SNA
        JMP TERMTR	    /YES
        LAC* BUFFPT
        AND (376	    /MASK BITS 10-16
        XOR (32	    /ZERO AC IF CR IN BITS 10-16
        SNA
        JMP TERMTR	    /YES
	LAC* BUFFPT
        JMS STRTTB
	JMS ATEND	/CHK FOR PHYS END OF BUFF
        ISZ BUFFPT
        JMP STCHK	    /SCAN ANOTHER WORD
CHKNXT	LAC* BUFFPT
	DAC BACKST	/STORE FIRST HAF TEMP.
	JMS ATEND
	ISZ BUFFPT
	LAC* BUFFPT	/LOAD IN SECOND HALF
        AND (700000     /MASK BITS 0-2
        XOR (500000     /ZERO AC IFCR REMAINS IN BITS 0-2
        SNA
	ISZ CRSW		/SET CR SWITCH FOR PRTERM
PRTERM	LAC BACKST	/LOAD TO STORE WORD 1
	JMS STRTTB	/GO STORE IN TT BUFF
	LAC CRSW		/CHECK CR SWITCH
	SNA		/IS SWITCH ON?
	JMP NOTERM	/NK.  CHECK WORD 2
	DZM CRSW		/RESET CR SWITCH
        JMP TERMTR		    /START CHECKING AGAIN
STRTTB  0 	    /ROUTINE TO LOAD TT BUFFER
        DAC* TTYPT	    /LOAD BUFFER
        ISZ TTYPT	    /RESET TT BUFFER POINTER
        JMP* STRTTB     /EXIT
TERMTR	LAC* BUFFPT
	JMS STRTTB	/LOAD BUFF. THEN OUTPUT
	JMS TTYSET
	LAC CHKCMS
	SZA		/JUST A CR CHECK?
	JMP* CRCHEK		/YES.  EXIT
	LAC (32002		/SET HEADER 0 FOR LP
	DAC TTBUF
	LAC INITTF
	JMS ERRSET		/GO OUTPUT TEXT
	LAC CHLASW
	SZA		/IS IT ON?
	JMP* INITBT	/YES
        LAC ENDOUT
	SAD BUFFPT
        JMP GOINIT	    /BUFFER EMPTY
	JMS ATEND
        ISZ BUFFPT	    /NOT EMPTY
	JMS TTYSET	/RESET TTBUFF FOR BLK. TR.
        JMP STCHK	    /GO GET ANOTHER LINE
	.EJECT
OVRCHK	0		/MONITOR POINTERS
	LAC ORBFPT
	SAD ENDOLD	/AT END OF OLD BUFF?
	ISZ OLDSWT	/YES
	LAC NWBFPT	/NO. CHK. NEW BUFFER
	SAD ENDNEW	/AT END OF NEW BUFFER
	SKP		/YES
	JMP ROSET+2	/NO CHECK OR BUFF.
ROSET	LAC OUTBFS	/RESET WORKING PTR
	DAC NWBFPT	/FOR NEW BUFFER
	LAC OLDSWT	/SW. ON?
	SNA
	JMP* OVRCHK	/NO
	LAC OUTBFI	/YES. RESET WORKING PTR
	DAC ORBFPT	/FOR OLD BUFFER
	DZM OLDSWT	/RESET SWITCH
	JMP* OVRCHK
CHKLDP	0		/CHK TO SEE IF LOAD PTR.
	LAC LDPTNW	/HAS BEEN REACHED
	SAD NWBFPT
	JMP QCHGON	/GO TEST FOR CHANGE SEARCH
	LAC LDPTOR	/MODE
	SAD ORBFPT
	JMP QCHGON	/GO QUESTION CHANGE ON
	JMP* CHKLDP
QCHGON	LAC CHLASW
	SNA
	JMP BACKUP
	LAC OROVER		/ BOMOUT
	TAD NWOVER
	SZA
	JMP* CHKLDP
	DZM CHLASW
	JMP ERR8
CHKMIN	0		/ROUT. TO DECREMENT CHKSW
	LAC CHKSW
	TAD (-1		/DECREMENT BY 1
	JMP* CHKMIN
KEEPCK	JMS ATEND
	ISZ BUFFPT
	JMP STCHK		/CONT. CHK FOR CR
TTYSET	0
	LAC TTBFI
	DAC TTYPT
	JMP* TTYSET
GOINIT	LAC ERRSW
	SZA		/IS ERROR OUTPUT SW ON?
	JMP* INITBT	/YES. EXIT AND REFILL
	LAC INPSW		/LOAD SEC. INP. SW
	SZA		/IS IT ZERO?
	JMS TTSET		/NO.  INIT PRIM BUFF
	JMP EXITBK
	.EJECT
/LINE BY LINE COMPARE WITHIN COMPARE BUFFERS.
STRCOM	DZM INPSW
	JMS EOFCHK
	JMP BUMPPT
COMPAR	LAC ORBFPT
	DAC BUFFPT	/INIT BUFFPT FOR CR SEARCH
	JMS CRCHEK
	LAC BUFFPT
	DAC EDOLIN	/STORE END OF ORIG LINE
	LAC NWBFPT
	DAC BUFFPT
	JMS CRCHEK
	LAC BUFFPT
	DAC EDNLIN	/STORE END OF NEW LINE
	DZM CHKCMS
CAGAN	LAC* ORBFPT
	SAD* NWBFPT
	JMP RECOMP
	JMS SETFCR	/GO GET CR PTR'S
	ISZ DIFFSW
	JMP YESCR
RECOMP	JMS ATCR		/AT CR?
	JMS OVRCHK
	ISZ ORBFPT	/NO CONTINUE
	ISZ NWBFPT
	JMP CAGAN
ATCR	0		/AT CR?  ROUT/
	LAC ORBFPT
	SAD EDOLIN
	JMP FOUND	/CR WORD FOUND
	LAC NWBFPT
	SAD EDNLIN
	JMP FOUND	/CR WORD FOUND IN NWE BUFF
	JMP* ATCR	/NOT FOUND.  CONT.
CPINFO	0		/ROUT TO WRITE CS
	LAC INERTF
	JMS ERRSET
	JMP* CPINFO
FOUND	JMS SETFCR	/SET PTRS
	DZM DIFFSW
	JMP YESCR
CRCHEK	0		/REENTRY FOR CR CHEK
	ISZ CHKCMS	/FOR JMP* IN STCHK
	JMP STCHK
SETFCR	0		/SET PTRS FOR CR'S
	LAC EDOLIN
	DAC ORBFPT
	LAC EDNLIN
	DAC NWBFPT
	JMP* SETFCR
	.EJECT
/LINE-LINE COMPARE ONCE ENDED. DISPATCH TO VARIOUS ROUTINES
YESCR	DZM CHKCMS
	LAC DIFFSW
	SZA			/IS DIFF. SW. ON?
	JMP DIFFCR		/YES,CR PRESENT ALSO
	DZM CHKCMS		/RESET ODD-EVEN WORD SW.
	LAC INLASW
	SZA			/IS INSERT LOOK AHEAD SW ON?
	JMP VERFIN		/YES. GO VERIFY INSERT.
	LAC DLLASW		/NO. CHECK DELETION LOOK AHEAD SW.
	SZA			/IS DELET. LOOK AHEAD SW ON?
	JMP VERFDL		/YES. GO VERIFY DELETION
	LAC CHNGCN		/IS CHANGE CNT NON-ZERO
	SZA
	JMP OCHG			/YES. GO VERIFY CHANGE
	ISZ LOCCNT
	JMS STLSCP	/GO SET OUTPTR
	JMS SETPTR
MOD1M	NOP		/JMS TAGCHK IF M SW ON
	DZM INPSW
	DZM TAGSW
	JMS CHDONP		/SET CHG DONE PTRS
	JMP REFILD
VERFIN	ISZ	CHKSW		/SET VERIFY CHK SWITCH
	JMS CHKLDP
	LAC	CHKSW
	SAD	VRFNUM		/HAVE VRFNUM LINES MATCHED
	JMP OINS		/YES. INSERT HAS BEEN VERIFIED. GO OUTPUT
	JMP	BUMPPT		/NO, GO BUMP PTR
SETPTR	0			/RESET DONE PTRS, AND LAST COMP PTRS.
	LAC ORBFPT
	DAC DONOPT
	DAC ORLSTM
	DAC LSTCMO
	LAC NWBFPT
	DAC DONNPT
	DAC NWLSTM
	DAC LSTCMN
	JMP* SETPTR
STLSCP	0
	LAC TMPPTR
	DAC OUTPTR
	DAC SEEKPT		/DEFINE PTR FOR TAGCHK
STRNXT	ISZ ERTTPT
	JMS ATEND0	/IS PTR AT END OF ORIG BUFF?
	ISZ TMPPTR
	LAC* TMPPTR	/STORE LAST MATCHED LINE
	DAC* ERTTPT	/IN SYNC MODE
	LAC TMPPTR
	SAD EDOLIN	/DONE?
	SKP		/YES.  REINIT AND CONT
	JMP STRNXT	/NO.  STORE NEXT WORD
	LAC LSCPLI	/LOAD LNLBUF+1
	DAC ERTTPT	/REINIT PTR
	JMP* STLSCP
	.EJECT
ATEND0	0		/IS TMPPTR AT ENDOLD?
	LAC TMPPTR
	SAD ENDOLD
	SKP		/YES.  RESET TO BUFFOP+1
	JMP* ATEND0	/NO
	LAC OUTBFI
	DAC TMPPTR
	JMP* ATEND0
ATENDF	0		/ROUT. TO PREVENT BUFFER ESCAPE
	LAC BOFFPT
	SAD ENDOLD
	SKP
	JMP* ATENDF
	LAC OUTBFI
	DAC BOFFPT
	JMP* ATENDF
ATENDL	0		/ROUT. TO PREVENT BUFFER ESCAPE
	LAC BUFLPT
	SAD ENDOLD
	SKP
	JMP* ATENDL
	LAC OUTBFI
	DAC BUFLPT
	JMP* ATENDL
ATEND1	0		/ROUT. TO PREVENT BUFFER ESCAPE
	LAC TLSTM
	SAD ENDOLD
	SKP
	JMP* ATEND1
	LAC OUTBFI
	DAC TLSTM
	JMP* ATEND1
	.EJECT
TRANSF	0		/ROUT. TO TRANSFER TAG+LOC
	JMS GOGTIN	/TO ASCII STATEMENT.  INIT GOGET
TAGAN	JMS GOGET	/GET CHR FROM TAGBUF
	ISZ TAGSW
	JMS TAGPAK	/STORE IN PROPER ASC. STAT.
	LAC CHR
	SAD (53		/A +?
	JMP LOCN	/YES.  GET LOCCNT
	SAD (40		/A SP?
	JMP LOCN	/YES.  GET LOCCNT
	JMP TAGAN	/NO GET ANOTHER CHAR.
LOCN	LAC LOCCNT
	JMS CVINIT	/GO CONVRT TO DEC AND PACK
	JMS LFCRPK	/GO PACK LF,CR
	LAC RTGPAK		/LOAD RETRN FOR REENTRY
	DAC TAGPAK
	LAC TMPST1
	SZA		/IS IT 0?
	JMP LOAD
RETRN	DZM TAGSW
	DZM CHRCNT
	JMS FIXLCT	/CORRECT LOCCNT
	JMP* TRANSF
GOGTIN	0		/INIT JMS GOGET
	LAC TAGSET
	DAC BUFLPT
	LAC TGPTDF
	DAC BOFFPT
	JMP* GOGTIN
	.EJECT
REFILI	LAC LDPTNW
	DAC BUFFPT
	ISZ INPSW
	JMP CHKFUL
REFILD	LAC LDPTOR
	DAC BUFFPT
	JMP CHKFUL
VERFDL	ISZ CHKSW			/SET VERIFY SW
	JMS CHKLDP
	LAC CHKSW
	SAD VRFNUM			/HAVE VRFNUM LINES MATCHED?
	JMP ODEL			/YES. DELETION VERIFIED . GO OUTPUT
	JMP BUMPPT		/GO BUMP BOTH PTRS
VERFCH	ISZ CHNGCN	/BUMP CHG LINE COUNTER
	LAC TMPPTR	/TEMPT STORE FOR XLSTCH
	DAC TLSTM
	ISZ CHLASW
	JMS CHKLDP
	DZM CHLASW	/RESET
	JMS CHDONP	/GO STORE CHG DONE PTRS
	JMS EOFCHK
	JMP BUMPPT
OCHG	ISZ CHLASW
	JMS CHKLDP
	DZM CHLASW
	JMS OUTCHG
	JMS CHDONP
	JMP MOD1M-2
BUMPPT	JMS OVRCHK		/CHK. PTRS.
	LAC ORBFPT
	DAC TMPPTR		/STORE FOR OUTLNL
	ISZ ORBFPT		/BUMP OLD BUFF PTR.
	ISZ NWBFPT		/BUMP NEW BUFF PTR.
	JMP COMPAR		/GO COMPARE ANOT. WD.
OINS	JMS AFTCHG
	JMS OUTINS
	JMS CHDONP
	JMP MOD1M-2
ODEL	JMS AFTCHG
	JMS OUTDEL
	JMS CHDONP
	JMP MOD1M-2
	.EJECT
DIFFCR	JMS OVRCHK	/AT END OF PHYS BUFF
	DZM DIFFSW
	ISZ ALIKE
	LAC CHKSW
	SZA		/IN VERIFY MODE?
	JMP STOPVR	/YES. STOP VERIFY
	ISZ DIFFCN	/NO  INCREMENT DIFF COUNT
	LAC INLASW
	SZA			/IS SW ON? IN SEARCH MODE?
	JMP INLAHD		/YES
	LAC DLLASW		/NO
	SZA			/IS SW ON?
	JMP DLLAHD		/YES
	LAC CHLASW		/NO
	SZA			/IS SW. ON?
	JMP VERFCH		/YES
	ISZ INLASW		/NO. JUST WENT OUT IF SYNC.
	DZM DIFFCN
	JMP PASCHG		/YES. ALSO VERIFY FAILED. GO RESET PTRS.
PASCHG	LAC CODNPT
	DAC ORBFPT
	LAC CNDNPT
	DAC NWBFPT
	JMP BUMPPT
AFTCHG	0		/ROUT. TO CHK FOR CHG OUTPUT WAIT
	LAC CHNGCN
	SNA		/IS IT ZERO?
	JMP* AFTCHG	/YES.  CONT
	DZM INLASW	/NO
	DZM DLLASW
	JMS OUTCHG	/GO OUTP CHG FIRST
	JMS XLSTCH		/GO STORE LAST CHANGED LINE
	JMS FIXLC1		/CORRECT LOCCNT
	JMP* AFTCHG
CHDONP	0		/STORE CHG DONE PTRS
	LAC ORBFPT
	DAC CODNPT
	LAC NWBFPT
	DAC CNDNPT
	JMP* CHDONP
	.EJECT
/DONE IN CASE OF BACK TO BACK MODIFICATIONS
XLSTCH	0		/ROUT. TO STORE LST CHANGED LINE
	LAC TLSTM	/LOAD LAST LSTCMO FROM OUTCHG
	DAC OUTPTR
XSTRNX	ISZ ERTTPT
	JMS ATEND1	/IS PTR AT END OF ORIG BUFF?
	ISZ TLSTM
	LAC* TLSTM
	DAC* ERTTPT	/STORE LST CHANGED LINE
	LAC TLSTM
	SAD CODNPT	/AT END OF LINE?
	SKP		/YES
	JMP XSTRNX
	LAC LSCPLI	/REINIT PTR
	DAC ERTTPT
	JMP* XLSTCH
	.EJECT
OCTDEC	0			/OCTAL TO DECIMAL CONVERSION
CONVRT	LAC	OCTNUM		/LOAD OCTAL NO.
	TAD	DECREM		/DECREMENT NO.
	SPA			/AC<=0?
	JMP	NXTDIG		/YES
	DAC OCTNUM
	LAC DECREM
	SNA
	JMP DGTSTR	/DECREM WAS 0
	ISZ	DIGCNT	/NO.BUMP PLACE VALUE CNT.
	JMP	CONVRT		/GO BACK
NXTDIG	LAC	DIGCNT		/LOAD PLACE VALUE
	TAD	(60		/CREATE ASCII CODE FOR
	DZM	DIGCNT		/PLACE VALUE DIGIT
	DAC	CHAR		/LOAD CHAR HOPPER
	JMP*	OCTDEC
DGTSTR	LAC OCTNUM
	DAC DIGCNT
	JMP NXTDIG
	.EJECT
OUTINS	0		/ROUT. TO OUTPUT INSERTION
	ISZ INLASW
	ISZ ERRSW
	LAC DFLPTI	/INIT BUFFPT TO ERR5BF+1
	JMS LNDFF	/GO OUTPUT NO OF LINES OF INSERT.
	LAC (2
	DAC CHRCNT	/SET CHRCNT FOR PK INTO ASCII STAT
	LAC* LOCBFI	/LOAD FIRST 2 CHRS OF ASC STAT
	AND (777760
	DAC TMPST1
	LAC (-2
	DAC FIRCNT	/INIT FOR STORE ROUT.
	LAC LOCBFI
	DAC BUFFPT	/INIT BUFFPT FOR CORRECT STORE
	JMS TRANSF	/GO OUTP TAG+LOC
	JMP ERR5		/GO OUTPUT ERR MESSG
MOD1AI	NOP		/JMP ABBRI IF A SW ON.  NOP OTHERWISE
NOABBI	LAC DONNPT
	DAC ENDOUT	/INIT INITBT OUTPUT LIMIT
	ISZ INLASW	/RESET SW ZEROED IN OUTLNL
	JMS INITBT	/OUTPUT INSERTED TEXT
	JMS LF2		/GEN. 2 LF'S
ABBRI	DZM INLASW
	ISZ ALIKE	/SUPPRESS SRC IDENT
	DZM CHKSW
	DZM ERRSW
	DZM INPSW
	DZM DIFFCN	/RESET DIFF LINE COUNT
	JMP* OUTINS	/EXIT
	.EJECT
OUTDEL	0		/ROUT. TO OUTPUT DELETION
	ISZ DLLASW
	ISZ ERRSW
	LAC DFLPTD	/INIT BUFFPT TO ERR6BF+1
	JMS LNDFF	/OUTPUT # OF DIFF LINES
	LAC (1
	DAC CHRCNT	/STE CHRCNT FOR PK INTO ASC. STAT.
	LAC* LOCBFD	/LOAD FIRST CHR OF ASC STAT
	AND (774000
	DAC TMPST1
	LAC (-3
	DAC FIRCNT	/INIT FOR STORE ROUT
	LAC LOCBFD	/INIT BUFFPT FOR CORREST STORE
	DAC BUFFPT
	JMS TRANSF	/OUTP TAG+LOC
	JMP ERR6		/OUTPUT ERR MESSG
MOD2AD	NOP		/JMP ABBRD IF A SW ON.  NOP OTHERWISE
NOABBD	LAC DONOPT
	DAC ENDOUT	/INIT INITBT OUTPUT LIMIT
	ISZ DLLASW	/RESET SW ZEROED IN OUTLNL
	JMS INITBT	/GO OUTPUT DELETED TEXT
	JMS LF2		/GEN. 2 LF'S
ABBRD	DZM DLLASW
	ISZ ALIKE	/SUPPRESS SRC IDENT
	DZM CHKSW
	DZM ERRSW
	DZM INPSW
	DZM DIFFCN
	JMP* OUTDEL	/EXIT
	.EJECT
OUTCHG	0		/ROUT. TO OUTPUT CHANGES
	ISZ CHLASW
	ISZ ERRSW
	LAC DFLPTC	/INIT BUFFPT TO ERR7BF+1
	JMS LNDFF	/OUTPUT # FO CHANGED LINES
	LAC (1
	DAC CHRCNT
	LAC* LOCBFC
	AND (774000
	DAC TMPST1
	LAC (-3
	DAC FIRCNT
	LAC LOCBFC
	DAC BUFFPT
	JMS TRANSF
	JMP ERR7		/OUTPUT CHANGE ERROR MESSG
MOD3AC	NOP		/JMP ABBRC IF A SW ON. NOP OTHERWISE
	DZM CHLASW
NOABBC	ISZ CHLASW
	JMS INITBT	/GO OUTP NEW LINE
	LAC BUFFPT
	DAC NWLSTM	/UPDATE
	ISZ CHLASW	/SET TO 2
	JMS INITBT	/OUTP ORIG LINE
	LAC BUFFPT
	DAC ORLSTM	/UPDATE
	JMS LF2
	LAC BUFFPT
	SAD CODNPT	/DONE?
	JMP ABBRC	/YES
	DZM CHLASW	/NO
	JMS LF2
	JMP NOABBC
ABBRC	DZM CHLASW
	ISZ ALIKE
	DZM CHKSW
	DZM ERRSW
	DZM CHNGCN
	DZM INPSW
	JMP* OUTCHG	/EXIT
	.EJECT
CVINIT	0		/ROUT. TO CONVERT 5 DIGIT
	DAC	OCTNUM		/OCTAL TO 5 DIGIT DECIMAL
INITDC	LAC*	DECRPT
	DAC	DECREM
	JMS	OCTDEC
	SAD (60		/AN ASCII 0?
	JMP ZSUPPR	/GO 0 SUPPRESS
	LAC (2		/PREVENT 0 SUPPRESS
	DAC ZSW
	JMS	TAGPAK
BYP0	ISZ	DECRPT
	ISZ	DIGCTR
	JMP	INITDC
	LAC	DECRST		/LOAD INIT PTR
	DAC	DECRPT		/RESET DECREM. PTR.
	LAC	(-5
	DAC	DIGCTR
	DZM ZSW
	JMP*	CVINIT
TAGCHK	0			/ROUTINE TO CHECK MATCHED LINE
INCYCL	ISZ	TAGSW		/FOR A TAG
	ISZ	SEEKPT		/SET PTR. TO LSTCMO+1
	LAC	SEEKPT
	DAC	BUFFPT
	LAC (-7		/INIT. TAG CHR. CNT.
	DAC TGCRCT
	LAC*	SEEKPT
	AND	(774000
	CLL
	RTL; RTL; RTL; RTL
	SAD (56		/A . ?
	JMP TGOSTR	/YES GO STORE
	SAD (45		/A % ?
	JMP TGOSTR	/YES GO STORE
	TAD (-101	/IN THE A-Z RANGE
	SPA
	JMP* TAGCHK
	TAD (-32
	SMA
	JMP* TAGCHK
TGOSTR	JMS TAGSTR
	JMP* TAGCHK
	.EJECT
TAGSTR	0			/STORE TAG FOR FUTURE REF.
	JMS	GETINT		/GO INIT.GETCHR ROUT.
	JMS	LKEQUL		/GO LOOK AHEAD FOR=
	DZM LOCCNT
	JMS RESET	/REINIT GETCHR
	LAC	TAGSET		/INIT PTR.FOR BLK
	DAC	BUFFPT		/TRANSFER
	JMS	GETINT		/GO INIT GETCHR WOUT.
REDO	JMS	GETCHR		/GO GET A CHAR
	ISZ TGCRCT
	SKP
	JMP PLUSGN
	LAC	CHAR
	SAD (15
	JMP PLUSGN
	SAD	(11		/IS CHAR A TAB?
	JMP	PLUSGN		/YES. IGNORE. GO GEN + AND EXIT
	SAD (40
	JMP PLUSGN
	JMS	TAGPAK		/GO STORE CHAR
	JMP	REDO		/REPEAT
PLUSGN	LAC	(53		/GENA + SIGN
	DAC	CHAR
	JMS	TAGPAK		/GO STORE + SIGN
	LAC BTGPAK		/LOAD COMBCK FOR TAGPAK REENTRY
	DAC TAGPAK
	LAC TMPST1		/IS IT 0?
	SZA
	JMP LOAD
COMBCK	LAC	CHRCNT
	DAC	INWDPT
TGEXIT	JMS	RESET		/GO REINIT GETCHR ROUT
	DZM	TAGSW		/REXT TAG SW. OFF
	LAC (15		/LOAD CHR WITH PHONY CR
	DAC CHR		/INCASE 1ST CHAR. SLASH HIT
	JMP*	TAGSTR		/EXIT
GETINT	0			/ROUT. TO INIT GETCHR ROUT.PTRS.
	LAC	SEEKPT		/FOR TAGSTR ROUT. USE
	TAD (-2
	DAC	TGSTPT		/SET TAG STORE PTS
	DAC BOFFPT
	ISZ	TGSTPT		/BUMP TAFSTR PTR TO WORD 2
	LAC TGSTPT
	DAC BUFLPT
	JMP*	GETINT		/EXIT
LKEQUL	0			/LOOK AHEAD FOR AN=SIGN
EQAGAN	JMS	GETCHR		/GO GET A CHAR
	LAC	CHAR
	SAD	(75		/IS IT AN=?
	JMP	TGEXIT		/YES.EXIT
	SAD	(11		/NO. IS IT A TAB?
	JMP*	LKEQUL		/YES.EXIT AND STORE TAG
	SAD (40
	JMP* LKEQUL
	SAD (15			/CR?
	JMP* LKEQUL
	JMP	EQAGAN		/NO.KEEP CHECKING
BACKUP	LAC INLASW		/COMING FROM AN INSERT.
	SZA			/SEARCH MODE?
	JMP DELINT		/YES. GO TO DEL. SEARCH MODE
	LAC DLLASW
	SZA
	JMP CHGINT	/GO INIT CHG. MODE
	JMS EOFCHK
	JMP SETBCK
	.EJECT
EOFCHK	0		/END OF INOUT FILE CHK
	LAC LDPTNW
	SAD NWBFPT	/NEW BUFF PTR AT LOAD PT?
	JMP ORCRCK	/YES  GO CNT EXTRA LINES
	LAC LDPTOR	/NO.  CHK ORIG PTR
	SAD ORBFPT	/ORIG PTRAT LOAD PT?
	JMP NWCRCK	/YES.  GO CNT EXTRA LINES
	JMP* EOFCHK	/NO.  CONT.
ORCRCK	LAC LDPTOR
	SAD ORBFPT	/ARE BOTH FILES EMPTY?
	JMP EQORDF	/YES.  FIND  OUT IF LAST LINES SAME
	LAC CHNGCN	/NO.  DID LINES MATCH?
	SNA
	JMP LSAGNO-1	/YES.  OUTPUT LAST DELETION
	JMS DPTRST	/NO.  SET DONE PTRS ONLY
	JMS OUTCHG	/GO OUTPUT LAST CHG
	JMS FIXLC1		/CORRECT LOCCNT
	JMS XLSTCH		/UPDATE LST COMP LINE
	JMP LSAGNO	/GO OUTPUT LAST DELETION
NWCRCK	LAC LDPTNW
	 SAD NWBFPT	/ARE BOTH FILE ENDED?
	JMP EQORDF	/YES.  FIND OUT IF LAST LINES MATCH
	LAC CHNGCN	/DID LAST LINES MATCH?
	SNA
	JMP LSAGNW-1	/YES.  OUTPUT LAST INSERTION
	JMS DPTRST	/NO.  SET DONE PTRS ONLY
	JMS OUTCHG	/OUTPUT LAST CHG
	JMS FIXLC1		/CORRECT LOCCNT
	JMS XLSTCH		/UPDATE LAST COMP LINE
	JMP LSAGNW	/OUTPUT LAST INSERTION
DPTRST	0		/RESET DONE PTRS FOR OUTCHG
	LAC ORBFPT
	DAC DONOPT
	LAC NWBFPT
	DAC DONNPT
	JMP* DPTRST
EQORDF	LAC CHNGCN
	SNA		/ARE LAST LINES DIFF?
	JMP LKA2		/NO.  OUTPUT END OF FILES
	JMS DPTRST	/YES.  RESET DONE PTRS
	JMS OUTCHG	/OUTPUT LAST CHG
	JMS FIXLC1		/CORRECT LOCCNT
	JMP LKA2	/OUTPUT FILES ENDED
	.EJECT
LOOKCR	0		/ROUT. TO LOOK-AHEAD FOR CR ON
	ISZ LOOKSW	/END OF FILE CONDITION
	JMS CRCHEK
	ISZ DIFFCN	/COUNT LINES
	ISZ TDFFCT		/INCREM TMP DIFFCN
	DZM LOOKSW		/RESET END OF FILE CR CHK SW
	DZM CHKCMS	/RESET
	JMP* LOOKCR	/EXIT
ZSUPPR	LAC ZSW		/IN LNDFF?
	SAD (0		/IN TAGSTR
	JMP ZKEEP		/YES.  IGNORE LEADING ZEROS
	SAD (1		/IN LNDFF
	SKP		/REPLACE 0 WITH SPACE
	JMP BYP0-1	/DON'T SUPPRESS 0
	LAC (40
	DAC CHAR
	JMP BYP0-1	/GO STORE SPACE
ZKEEP	LAC DIGCTR		/DON'T SUPPRESS 0
	SAD (-1		/IN THE UNITS PLACE
	JMP BYP0-1	/STORE LAST 0
	JMP BYP0
DELINT	DZM INLASW
	DZM CHKSW
	DZM DIFFCN
	ISZ DLLASW
	JMP PASCHG
CHGINT	DZM DLLASW
	DZM CHKSW
	DZM DIFFCN
	ISZ CHLASW
	JMP PASCHG
	.EJECT
	JMS FIXLC1
LSAGNO	LAC CODNPT	/OUTPUT REMAINDER OF ORIG FILE AS
	DAC BUFFPT	/A DELETION
	DZM DIFFCN
LKMORR	JMS ATEND
	ISZ BUFFPT
	JMS LOOKCR	/LOOK-AH FOR CR'S AND COUNT
	LAC BUFFPT
	SAD LDPTOR	/ALL DONE
	SKP		/YES
	JMP LKMORR	/NO
	JMP DELOUT	/GO PUT DELETION
	JMS FIXLC1
LSAGNW	LAC CNDNPT
	DAC BUFFPT
	DZM DIFFCN
LKMORE	JMS ATEND
	ISZ BUFFPT
	JMS LOOKCR
	LAC BUFFPT
	SAD LDPTNW
	SKP		/YES
	JMP LKMORE
	JMP INSOUT
DELOUT	LAC BUFFPT
	DAC DONOPT
	JMS OUTDEL
	JMS LKA
	LAC VRFNUM		/CORRECT LOCCNT
	TAD TDFFCT
	CMA
	TAD (1
	TAD LOCCNT
	DAC LOCCNT
	JMP ERR8		/LOOK-AHEAD CAP EXCEEDED
INSOUT	LAC BUFFPT
	DAC DONNPT
	JMS OUTINS
	JMS LKA
	LAC VRFNUM
	CMA
	TAD (1
	TAD LOCCNT
	DAC LOCCNT
	JMP ERR8
LKA	0		/ROUT. TO DETERMINE IF AT END OF FILES
	LAC NWOVER
	TAD OROVER
	SAD (2		/AT END
	JMP ERR11	/OUT END OF FILES
	JMP* LKA	/LOOK-AHEAD CAP EXCEEDED
LKA2	LAC OROVER	/ROUT. TO DETERM IF AT END OF FILES
	TAD NWOVER
	SAD (2
	JMP ERR11	/AT END OF FILES
	JMS STLSCP	/STORE LST LINE BEFORE MOD
	JMP ERR8	/LOOK-AHEAD CAP EXCEEDED
FIXLC1	0		/ROUT. TO CORRECT LOCCNT FOR OUTCHG
	LAC LOCCNT
	TAD (-1
	DAC LOCCNT
	JMP* FIXLC1
	.EJECT
SETBCK	LAC LSTCMO
	DAC ORBFPT
	LAC LSTCMN
	DAC NWBFPT
	JMP BUMPPT
STOPVR	LAC INLASW	/ROUT. TO STOP VERIFY MODE
	SZA
	JMP REINLA		/GO REINIT INLA
	LAC DLLASW
	SZA
	JMP REDLLA		/GO REINIT INLA
	JMS UPLOC		/GO UPDATE DIFFCN
	JMP CHLAHD
REINLA	JMS UPLOC
	JMP INLAHD
REDLLA	JMS UPLOC
	JMP DLLAHD
UPLOC	0		/ROUT. TO UPDATE DIFFCN
	LAC DIFFCN		/UPDATE DIFFCN
	TAD CHKSW
	DAC DIFFCN
	DZM CHKSW
	JMP* UPLOC
INLAHD	LAC CODNPT		/RESET OLD BUFF PTR TO LAST CR COMP
	DAC ORBFPT
	JMS CHKLDP			/GO CHECK FOR LOAD PTR.
	LAC NWBFPT
	DAC DONNPT
	JMP BUMPPT
DLLAHD	LAC CNDNPT		/RESET NEW PTR. TO LAST
	DAC NWBFPT		/COMP. CR
	JMS CHKLDP		/GO CH
	LAC ORBFPT
	DAC DONOPT
	JMP BUMPPT
CHLAHD	ISZ CHNGCN		/INCREMENT CHANGE CONT.
	JMS CHKLDP			/GO CHECK TO SEE IF LOAD PTR. HIT
	DZM CHLASW		/RESET CHG. LOOK AT TO OFF
	DZM ERRSW			/RESET ERROR OUTP. SW
	DZM INPSW			/RESET INPUT SW
	ISZ INLASW		/SET INSERTION SW.
	LAC ORBFPT
	DAC DONOPT
	LAC NWBFPT
	DAC DONNPT
	JMP BUMPPT		/GO BUMP PTRS.
	.EJECT
TTSET	0		/ROUT. TO INIT FOR PROG. RESTART
	LAC (32002
	DAC LNLBUF
	LAC TTBFI
        DAC TTYPT	    /RESET TT BUFFER
	LAC (50320
	DAC LNLBUF+2
        DZM WPCNT	    /RESET WP COUNT FOR GETCHR ROUT.
        LAC (-1
        DAC CARCNT	    /RESET CNT FOR GETCHR ROUT.
	LAC	(-176
	DAC	ALLCNT	/REINIT CHAR. COUNT.
	LAC ENDOLD
	DAC DONOPT
	LAC FDBKAR
	DAC NXTONE+1	/RESET CS ROUT. FOR CS
	LAC (JMS ZDIRBF
	DAC NXTONE-1
	LAC (JMS SETDEF
	DAC REERBF+1
	LAC DECRST	/SET OCTDEC PTR
	DAC DECRPT
	LAC ENDNEW
	DAC DONNPT
	LAC ORPTIN
	DAC ORBFPT
	DAC OUTPTR
	DAC LSTCMO
	DAC LDPTOR
	DAC ORLSTM
	DAC CODNPT
	LAC NWPTIN
	DAC NWBFPT
	DAC CNDNPT
	LAC OUTBFS		/FOR FIRST FILL
	DAC LDPTNW
	DAC LSTCMN
	DAC NWLSTM
	LAC LSCPLI
	DAC ERTTPT
	ISZ TAGSW		/FOR REENTRY FOL RESET
	JMS RESET		/INIT GETCHR ROUT
	DZM ERRSW
	DZM TAGSW
	DZM CHKSW
	DZM CHRCNT
	DZM INLASW
	DZM DLLASW
	DZM CHLASW
	DZM INPSW
	DZM OROVER
	DZM NWOVER
	DZM CHKCMS
	DZM DIFFSW
	DZM LOCCNT
	DZM CHGLCN
	DZM LA
	DZM SW
	DZM PKCNT
	DZM CHNGCN
	DZM WHFLSW
	DZM TDFFCT
	JMS ASLINS	/GO PK TOP+ INTO TAGBUF
	LAC OUTBFI
	DAC BUFFPT
	LAC (15
	DAC CHR		/ALLOW FOR 1ST COMMENT
	JMP* TTSET
	.EJECT
SETDEF	0		/ROUT. TO SET DEFLT COND
	LAC MSW3OF	/LOAD JMS OUTLNL
	JMS LINMOD
	LAC ASWOFF	/LOAD NOP
	DAC MOD1AI
	DAC MOD2AD
	DAC MOD3AC
	DAC MOD1M
	LAC CSW1OF	/LOAD JMS GETCHR
	DAC NXTCHR
	LAC MSW4OF	/LOAD JMP ASPACK
	DAC MOD2M
	JMP* SETDEF
ASLINS	0		/SET TAGBUF TO LINE<40>
	LAC TAGSET
	DAC TGBFPT	/SET PTR TO TAGBUF+1
	ISZ TGBFPT
	LAC FSTTAG
	DAC* TGBFPT
	ISZ TGBFPT
	LAC LSTTAG
	DAC* TGBFPT
	JMP* ASLINS
EXITBK	LAC ALIKE
	SNA		/WERE THERE ANY CHANGES?
	JMP ERR12		/NO  GO SAY INDENTICAL PROGRAMS
	.CLOSE TTYCMD
	.CLOSE TTYCTR
	.CLOSE ORSLOT
	.CLOSE TTYERR
	.CLOSE NWSLOT
	DZM ALIKE
        JMP GOSTR1	    /GO FILL ANOTHER BUFFER
	.EJECT
ZSW	0		/0 SUPPRESS SWITCH
TLSTM	0		/STORAGE FOR LST CR BEF LST CHANGED LINE 
TDFFCT	0		/TMPT STORAGE FOR DIFFCN IN EOFCHK
FSTTAG	462231		/FIRST PART OF DEF. LINE SP
LSTTAG	642500		/LAST PART OF DEF. LINE SP
DUMPTR	0		/DUMMY PTR FOR ERR8 ROUT.
DFLPTI	ERR5BF+1	/ENTRY FOR DIFFCN IN INSERT MESG
DFLPTD	ERR6BF+1		/ENTRY FOR DIFFCN IN DELET MESG
DFLPTC	ERR7BF+1		/ENTRY FOR DIFFCN IN CHANG MESG
LOCBFI	ERR5BF+14		/ENTRY FOR TAG+LOC IN INSERT MESG
LOCBFD	ERR6BF+14	/ENTRY FOR TAG+LOC IN DELET MESG
LOCBFC	ERR7BF+14		/ENTRY FOR TAG+LOC IN CHANG MESG
LOCBFE	ERR8BF+16	/ENTRY FOR TAG+LOC IN EXCD MESG
VRFNUM	3		/REMATCH FACTOR
CODNPT	0		/DONE PTRS FOR CHG IN ORIG SRC
CNDNPT	0		/DONE PTRS FOR CHG IN NEW SRC
ALIKE	0		/FILES ALIKE SW (IF 0, ALIKE)
LOOKSW	0		/EOF CR LOOK AHEAD SW
OROVER	0		/END OF ORIG FILE SW
NWOVER	0		/END OF NEW FILE SW
BUFFPT	0		/WORKING COMP. BUFF TRANSF PTR
BOFFPT	0		/WORKING PTR FOR FIRST HALF OR WP
BUFLPT	0		/WORKING PTR FOR LAST HALF OF WP
DONOPT	0		/DONE PTR FOR ORGINAL BUFF
DONNPT	0		/DONE PTR FOR NEW BUFF
LDPTOR	0		/LOAD PTR FOR ORG BUFF
LDPTNW	0		/LOAD PTR FOR NEW BUFF
ORBFPT	0		/ORG BUFFER PTR
NWBFPT	0		/NEW BUFFER PTR
TTYPT	0		/LINE BUFFER PTR
EOM	6		/END OF MEDIUM FLAG
EOF	5		/END OF FILE FLAG
IOPASC	2		/IOPS ASCII DATA FLAG
SW      0 	    /MULT. SP-TAB SWITCH
LA      0 	    /LOOK AHEAD SWITCH
WSTCNT  0 	    /WASTED BIT COUNTER
CHRCNT  0 	    /MOD 5 CHR. CNT. FOR INP. TOCOMP. BUF
CARCNT  777777	    /CHR. CNT. FOR GETCHR ROUT.
HANGOV	0		/OVER HANG SWITCH
WPCNT   0 	    /WP CNT. FOR GETCHR ROUT.
NEWCNT  0 	    /INP. CHR. CNT. TO COMP. BUFF.
NEWCMA	0		/NEGATIVE NEW BUFFER SIZE
OLDCMA	0		/NEGATIVE OLD BUFFER SIZE
OCTNUM	0		/NUMERAL IN OCTAL TO BE CONV. TO DEC.
DECRPT	TENTHO		/PTR. FOR DECREMENTING IN OCTDEC ROUTINE
WKCMAN	0		/WORKING NEGATIVE NEW BUFF SIZE
WKCMAO	0		/WORKING NEGATIVE OLD BUFF SIZE
TGPTDF	TAGBUF		/INIT DEFINED TAG BUFFER STARTING LOC.
STRPLS	TAGBUF+6		/POSITION OF STORAGE OF "+"SIGN
DECREM	0		/WORKING DECREMENTER IN OCTDEC ROUTINE
DIGCTR	-5		/IMP. DIG. CNTR. FOR INITDC ROUTINE
DIGCNT	0		/0 TO 11 CNTR. FOR DEC. PLACE VALUE
LOCCNT	0		/LOCATION COUNTER
LSTCMO	0		/LAST LINE COMP. ADDRESS IN OLD BUFFER
LSTCMN	0		/LAST LINE COMP. ADDRESS IN NEW BUFFER
DIFFSW	0		/DIFFERENCE IN LINES SWITCH
CHKCMS	0		/ODD-EVEN WORD SWITCH. 0 IF EVEN
CRWD0	0		/BITS 14-17 HAVE 0001 IN WORD 1 OF WP
LDCNTR	777776		/LOAD TAG CHAR. CNTR. INIT. -2
ENDTAG	0		/LAST WORD STR. TAG USED
TGBFPT	0		/WORKING TAG BUFFER PTR.
TENTHO	754360		/NEG. OCTAL EQUIV. OF 10,000 BASE 10
THOU	776030		/NEG. OCTAL EQUIV. OF 1000 BASE 10
HUND	777634		/NEG OCTAL EQUIV. OF 100 BASE 10
TEN	777766		/NEG. OCTAL EQUIV. OF 10 BASE 10
ZER0	0		/OCTAL EQUIV. OF 0 BASE 10
INLASW	0		/INSERTION LOOK AHEAD SWITCH
DLLASW	0		/DELETION LOOK AHEAD SWITCH
CHLASW	0		/CHANGE LOOK AHEAD SWITCH
ERRSW	0		/ON CHECK AHEAD FOR ERROR SWITCH
CHKSW	0		/VERIFY 4 LINE SWITCH
ORLSTM	0		/LAST COMP. BEFORE VERIFY COMPLETED OLD
NWLSTM	0		/LAST COMP. BEFORE VERIFY COMPLETED NEW
CHNGCN	0		/CNTR. FOR LINES OF CHANGE
OLDSWT	0		/SWITCH IN MONITOR ROUTINE
TEMPCN	0		/TEMP. LOC. CNTR.
DIFFCN	0		/DIFF. LINE CNTR.
SAMESW	0		/WORDS COMPARED SWITCH
SEEKPT	0		/TAGCHK PTR.
TGCRCT	0		/TAG CHAR INT INCL. + SIGN
TGOTCN	0		/TGCRCT STORAGE FOR TAGOUT ROUT.
TGCRPT	0		/WORK.PTR.FOR GETINT ROUT.
TAGSW	0		/TAG SWITCH
OWRKPT	0
NWRKPT	0
PKCNT   0 	    /CHR. PACK CNT. ON LOOK AHEAD
ALLCNT  -176 	    /INP. TT CHR CNT. BEFORE PACK
CHRTMP	0		/LOOK AHEAD CHR HOPPER
CHR	0	/ASPACK CHR HOPPER
TEMP1	0	/SHFT CNT IN GETCHR ROUT.
LSTHAF	0	/LAST HAF OF WP
FSTHAF	0	/FIRST HAF OF WP
ENDOUT	0	/END POINT OF COMP. BUFFER
HOLD	0	/TEMP. STORAGE IN STORE ROUT.
CHAR	0	/CHR HOPPER FILLED BY GETCHR ROUT.
FIRCNT	777774	/CHR. CNT FOR WORD 1 OF STORE ROUT.
LASCNT	777775	/CHR. CNT FOR WORD 2 OF STORE ROUT.
TMPST1	0	/TEMP. STORAGE FOR WORD 1
TMPST2	0	/TEMPSTORAGE FOR WORD 2
BACKST	0	/TEMP STOR. FOR FIRST HAF IN CHKNXT ROUT
DECRST	TENTHO	/INIT PTR. FOR INITDC
INWDPT	0		/IN WORD PTR. FOR PLUSFN IT.
TGSTPT	0		/TAG STORE WORKING PTR.
NEWDIT	NEWDBF		/NEW DIRECTORY BUFFER
ORGDIT	ORGDBF		/ORIG. DIRECTORY BUFFER
ZLOCST	ORGDBF-1	/INIT. LOC FOR ZEROING ROUT.
FILESW	0		/CS FILE ERROR SWITCH COUNT
ISACOM	031715		/SIXBIT "COM"
PKCNTR	777772		/CONTR. FOR PACK OF FILENAME + EXT.
WHFLSW	0		/WHICH FILE SW
DIRSTR	0		/STORAGE HOPPER FOR SIXBIT CHAR.
SHWFCT	777775		/SHIFT-WORD-FILL-COUNTER FOR SBCHRS
BUMCTR	-3		/BUMP PTR. COUNTER
TTY	ORSLOT		/INIT INPUT .DAT SLOT
TAGEND	0		/END FOR TAG+ BLK TRANSF
CHGLCN	0		/COUNTER FOR NO OF CHG. LINES
OUTPTR	0		/PTR FOR CR BEFORE LST COMP
EDOLIN	0		/END OF OLD LINE
EDNLIN	0		/END OF NEW LINE
TMPPTR	0		/TEMP. STR FOR OUTPTR
TPTTBF	0		/TEMP STOR FOR TTBUF
RTGPAK	RETRN		/REENTRY FOR TRANSF FROM TAGPAK
BTGPAK	COMBCK		/REETRY FOR TAGSTR FROM TAGPAK
ERTTPT	ERRTTB+1		/CS INP AND OUTLNL OUTP BUFF
ERR1PT	ERR1BF		/PTR TO ERROR #1 BUFFER
ERR2PT	ERR2BF		/PTR TO ERROR#2 BUFFER
ERR3PT	ERR3BF		/PTR TO ERROR#3 BUFFER
ERR4PT	ERR4BF		/PTR TO ERROR#4 BUFFER
ERR5PT	ERR5BF		/PTR TO ERROR#5 BUFFER
ERR6PT	ERR6BF		/PTR TO ERROR#6 BUFFER
ERR7PT	ERR7BF		/PTR TO ERROR#7 BUFFER
ERR8PT	ERR8BF		/PTR TO ERROR#8 BUFFER
ERR9PT	ERR9BF		/PTR TO ERROR # 9 BUFFER
ER10PT	ER10BF		/PTR TO ERR0R #10 BUFFER
ER11PT	ER11BF		/PTR TO ERROR #11 BUFFER
ER12PT	ER12BF		/PTR TO ERROR # 12 BUFFER
ER13PT	ER13BF		/PTR TO ERR # 13 BUFF
ER14PT	ER14BF		/PTR TO ERR # 14 BUFF
ER15PT	ER15BF		/PTR TO ERR # 15 BUFF
ER16PT	ER16BF		/PTR TO ERR# 16 BUFFER
ER20PT	ER20BF		/PTR TO ERROR # 20 BUFF
TWOLFP	TWOLFB		/PTR TO 2LF BUFF
COMPTR	COMBUF		/PTR TO SRCCOM BUFF
ANGBPT	ANGBBF		/PTR TO < CR BUFF
COMLOC	ORGDBF+10	/LOC OF COM EXT
	.EJECT
/MODULES FOR SWITCH SETTING ROUTINES
MSW1	JMS TAGCHK	/MOD FOR M SW ON
ASW1ON	JMP ABBRI	/MOD FOR A SW IN WITH INERT
ASW2ON	JMP ABBRD	/MOD FOR A SW IN WITH DELET.
ASW3ON	JMP ABBRC	/MOD FOR A SW IN WITH CHG.
MSW3ON	NOP		/MOD FOR M SW ON.
FDBKAR	SAD (15		/DEFAULT FOR NXTONE+1
MSW3OF	JMS OUTLNL	/MOD FOR M SW OFF.  LST LINE BEFORE
ASWOFF	NOP		/MOD FOR A SW OFF
MSW4ON	NOP		/MOD FOR M SW ON
MSW4OF	JMP ASPACK	/MOD FOR M SW OFF
CSW1ON	JMS GOGET	/MOD FOR S SW ON
CSW1OF	JMS GETCHR	/MOD FOR S SW OFF
	.EJECT
TWOLFB	TWOLFE-TWOLFB/2*1000
	0
	.ASCII <12><40><15>
TWOLFE=.
ANGBBF	ANGBED-ANGBBF/2*1000
	0
	.ASCII '>'<175>
ANGBED=.
COMBUF	COMBED-COMBUF/2*1000+2
	0
	.ASCII 'SRCCOM V3UOW'<12><15>
COMBED=.
ERR1BF	ERR1ED-ERR1BF/2*1000
	0
	.ASCII 'INVALID SWITCH'<12><15>
ERR1ED=.
ERR2BF	ERR2ED-ERR2BF/2*1000
	0
	.ASCII	'TOO MANY CHARS IN FILE OR EXT'<12><15>
ERR2ED=.
ERR3BF	ERR3ED-ERR3BF/2*1000
	0
	.ASCII 'BOTH FILES NOT SPECIFIED'<12><15>
ERR3ED=.
ERR4BF	ERR4ED-ERR4BF/2*1000
	0
	.ASCII 'COM USED AS AN INPUT EXT'<12><15>
ERR4ED=.
ERR5BF	ERR5ED-ERR5BF/2*1000
	0
	.ASCII '      LINES INSERTED BELOW                '<175>
ERR5ED=.
ERR6BF	ERR6ED-ERR6BF/2*1000
	0
	.ASCII '      LINES DELETED BELOW                '<175>
ERR6ED=.
ERR7BF	ERR7ED-ERR7BF/2*1000
	0
	.ASCII '      LINES CHANGED BELOW                '<175>
ERR7ED=.
ERR8BF	ERR8ED-ERR8BF/2*1000
	0
	.ASCII 'LOOK-AHEAD CAPABILITY EXCEEDED AT                '<175>
ERR8ED=.
ERR9BF	ERR9ED-ERR9BF/2*1000
	0
	.ASCII 'FILENAMES NOT ON INPUT DEVICES'<12><15>
ERR9ED=.
ER10BF	ER10ED-ER10BF/2*1000
	0
	.ASCII 'IMPROPER DATA MODE'<12><15>
ER10ED=.
ER11BF	ER11ED-ER11BF/2*1000
	0
	.ASCII 'END OF INPUT FILES REACHED'<12><15>
ER11ED=.
ER12BF	ER12ED-ER12BF/2*1000
	0
	.ASCII 'SOURCE PROGRAMS IDENTICAL'<12><15>
ER12ED=.
ER13BF	ER13ED-ER13BF/2*1000
	0
	.ASCII 'END OF ORIG SRC--MORE? (Y OR N?)'<12><15>
ER13ED=.
ER14BF	ER14ED-ER14BF/2*1000
	0
	.ASCII 'END OF NEW SRC--MORE? (Y OR N?)'<12><15>
ER14ED=.
ER15BF	ER15ED-ER15BF/2*1000
	0
	.ASCII '?'<12><15>
ER15ED=.
ER16BF	ER16ED-ER16BF/2*1000
	0
	.ASCII 'BAD INPUT DATA'<12><15>
ER16ED=.
ER20BF	ER20ED-ER20BF/2*1000
	0
	.ASCII 'NO CORE FOR COMP BUFFS'<12><15>
ER20ED=.
	.EJECT
OUTDPT	OUTDBF		/SET PTR FOR OUT DIR.
ORGDBF	.BLOCK	3	/ORIG. DIRECTORY BLOCK
NEWDBF	.BLOCK	3	/NEW DIRECTORY BLOCK
OUTDBF	.SIXBT '@@@@@@COM'	/FILE NAME AND FOR OUT DEV
LNLBUF	.BLOCK 64		/OUTBUF FOR LST COMP LINE
CSERSW	0	/ERROR IN CS SWITCH
SIXPTR	0		/SIXPAK PNTR
ZPNTR	0		/PTR. FOR ZDIRBF
CRSW	0	/CR SWITCH IN BLK. TR. ROUT.
INPSW	0	/SECONDARY INPUT SWITCH
BUFFIP	0			/SECONDARY COMP. BUFFER
TAGBUF	.BLOCK 12		/TAG BUFFER
BUFFOP	0			/PRIMARY COMP. BUFFER	
TTBUF	.BLOCK 100	/TT IN-OUT BUFFER
        .END GOSTRT
