Google
 

Trailing-Edge - PDP-10 Archives - bb-d549g-sb - camctl.mac
There are 3 other files named camctl.mac in the archive. Click here to see a list.
TITLE	CAMCTL	VERSION 3	
SUBTTL	CAM CONTROL PROGRAM		CWRU/CAM

;EDIT==6

;COPYRIGHT 1971, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
	HISEG


	A1=1
	A2=2
	A3=3
	A4=4
	A5=5
A7=7
	RC=16
	CHAR=13
	RETURN=14
	BAS=6
	USE=5
	DISK=200000
	DTAPE=100
	DCHAN=17
	LF=12
	VT=13
	FF=14

	ENTRY	CMORE,LINEIN
	ENTRY	HEDOUT
	ENTRY	NUMCNV
	EXTERN	TEMP4
	ENTRY	MESAPS
	EXTERN	SAVXFF,FIRTIM,.JBFF
	EXTERN	TEMP3
	EXTERN	SYSIPT,DSKFLG,BASDDB,USEDDB,MRGDDB,LSTDDB
	EXTERN	LOGDDB,BOL,T2,LINENO,STORED,STORD2,CMDLVL
	EXTERN	CAMOPT,BASPTR,SFMODE,BASSRC,USESRC
	EXTERN	EOFERR,LOGOUT,MRGOUT,LSTOUT,MCBUF,UCBUF
	EXTERN	MCIN,UCIN,LOGMSR,CAMM,MESJ,ERRD,ERRE,LSTOP
	EXTERN	CBGET,CMP,CMRG,COMERG,CONVRT,DELET,DIALOG
	EXTERN	ERRC,FED,FILBFR,FLM.2,FLU.2,FLUSH
	EXTERN	I,INCOPT,LOOKF,MANCOR,MCDDB,MESGC,MESL,PTSTOR
	EXTERN	PUSHST,SAV4,STSYNC,TEMP,UCDDB,UCOR
MESAPS:	POINT	6,A1,
PTSPSP:	ASCIZ /. /
	DEFINE	LOGMSG(A,B,C,D,E,F,G,H) <XLIST
	JSP	A7,LOGMSR
	XWD	A,B
	XWD	C,D
	XWD	E,F
	XWD	G,H
	LIST>
	DEFINE	SAVE <XLIST
	MOVE	.JBFF
	MOVEM	FFSAVE
	LIST>

	DEFINE	RESTOR <XLIST
	MOVE	FFSAVE
	MOVEM	.JBFF
	LIST>

	DEFINE	LOOK(A,B) <XLIST
	JSP	A5,LOOKF
	XWD	A,B
	LIST>

	DEFINE	FLSH(A,B) <XLIST
	JSP	A1,FLUSH
	XWD	A,B
	LIST>

	DEFINE CNVT(A,B,C,D) <XLIST
		JSP	RETURN,CONVRT
			XWD A,B
			XWD C,D
			LIST>
	DEFINE	FCAL(A,B,C) <XLIST
	JSP	RETURN,A
		B
		C
		LIST>
	DEFINE	FILBUF(A,B) <XLIST
	JSP	A7,FILBFR
	XWD	A,B
	LIST>
	DEFINE	OUTHED(A) <XLIST
	FCAL	MRGOUT,[43],A+1
	XLIST
	JSP	RETURN,LINEIN
	FCAL	LSTOUT,[43],A+1
	XLIST
	SETOM	T2		;BEG OF LINE IN LSTOUT
	LIST>
D1.:	POINT	7,UCBUF+4,6
	POINT	7,UCBUF+4,13
	POINT	7,UCBUF+4,20
	POINT	7,UCBUF+4,27
D6.:	POINT	6,UCBUF+11,5
	POINT	6,UCBUF+11,11
	POINT	6,UCBUF+11,17
MESL.1:	POINT	7,MESL+1,27
MESL.2:	POINT	7,MESL+7,6
CAMPTR:	POINT	7,3(A5),6
	POINT	7,4(A5),20
	POINT	7,7(A5),27
	POINT	7,11(A5),6
	POINT	7,14(A5),
	OPDEF	OUTSTR[TTCALL 3,0]
	POINT	7,15(A5),13
	OPDEF	INCHRW[TTCALL 4,0]
	SYN	INCHRW,INCHWL
	OPDEF	OUTCHR[TTCALL 1,0]
	OPDEF	CLRBFI[TTCALL 11,0]
MESGCZ:	POINT	7,MESGC,
MESCP1:	POINT	7,MESGC,13
MESCP2:	POINT	7,MESGC+1,27
MESCP3:	POINT	7,MESGC+2,20
MESCP4:	POINT	7,MESGC+4,
NFPER:	POINT	7,MESGC+1,27
OFPER:	POINT	7,MESGC+3,34
;	CAM CONTROL PROGRAM
	EXTERN	ATFLAG

CSTART:
	SETZM	ATFLAG		; CLEAR COMMAND FILE INPUT FLAG
	CALLI	0
	MOVE	16,[XWD -10,PUSHST]
	SETZM	FED		;CAM
	SETOM	FIRTIM
	INIT	DCHAN,14
	SIXBIT	/DSK/
	XWD	0,SYSIPT
	JRST	ERRR
	SETZM	DSKFLG
	INBUF	DCHAN,1
	JRST	OVERRR
ERRR:	SETOM	DSKFLG
OVERRR:
CMORE:
	RELEAS	5,		;BASE CHANNEL RELEAS
	RELEAS	1,		;RELEAS LOGOUT CHANNEL
	RELEAS	6,		;RELEAS USER CHANNEL
	RELEAS	2,		;RELEAS MRGOUT CHANNEL
	RELEAS	3,		;RELEAS LSTOUT CHANNEL
	SETZM	BASDDB+6	;ZERO BASE STATUS
	SETZM	USEDDB+6	;ZERO USER STATUS
	SETZM	MRGDDB+6	;ZERO MRG STATUS
	SETZM	LSTDDB+6	;ZERO LST STATUS
	SETZM	LOGDDB+6	;ZERO LOG STATUS
	
	SETOM	BOL
	SETOM	BOL+1		;BEG OF LINE IND IN MC UC
	SETOM	T2		;LSTOUT BEG OF LINE
	SETZM	LINENO		;LSTOUT LINENO
	SETZM	STORED		;MC STORE SWITCH
	SETZM	STORED+1	;UC STORE SWITCH
	SETZM	STORD2		;MC STORE2 SWITCH
	SETZM	STORD2+1	;UC STORE2 SWITCH
	PUSHJ	16,CMDLVL	;GET COMMAND STRIN
	SKIPL	FIRTIM	;IS THIS FIRST COMMAND STRING ?
	JRST	OV4		;NO
	MOVE	.JBFF		;YES-SAVE .JBFF
	MOVEM	SAVXFF
	SETZM	FIRTIM		;RESET FIRST TIME
	JRST	OV5		;
	OV4:	MOVE	SAVXFF
	MOVEM	.JBFF		;RESET .JBFF
OV5:
	SKIPLE	CAMOPT		;
	JRST	CAMTGR		;CAM TOGETHER
	SKIPN	CAMOPT
	JRST	CMPREX		;COMPARE ONLY
	JRST	COMERX		;COMERG ONLY



;	COMPAREONLY CONTROL PROGRAM
;	FIRST FIND AN ACCEPTABLE BASE FILE
;	THEN A CORRESPONDING USER FILE
;	THEN RUN COMPARE

;	INITIALIZATION

CMPREX:
	HRREI	A1,-26
	MOVEM	A1,BASPTR
	SKIPL	SFMODE		;IS IS SINGLE FILE MODE ?
	JRST	SFR		;YES
	SETZM	BASDDB+2
BASPT:
BASPT2:
	JSP	A5,BASSRC	;FIND BASE FILE
	JRST	EOFERR
	JFCL			;NOP
	JSP	A5,USESRC	;FIND CORR USER FILE
	JRST	EOFERR		;
	JRST	BASPT2
	JRST	CMP.20		;OUTPUT LOG MSG
CMP.11:
	JSP	A5,CMPRXC	;COMPARE CONTROL PROGRAM
	JRST	BASPT		;GET NEXT BASE FILE


SFR:
	RELEAS	5,
	RELEAS	6,
	LOOK	BASDDB,ERRC		;LOOKUP BASE FILE
	LOOK	USEDDB,ERRD		;LOOKUP USER FILE
	JRST	CMP.20		;OUTPUT LOG MSG
CMP.12:
	JSP	A5,CMPRXC	;COMPARE CONTROL PROGRAM
	JRST	CMORE		;NEXT COMMAND STRING

CMP.20:
	LOGMSG	CMP,CAMPTR,BASDDB+2,BASDDB+3,USEDDB+2,USEDDB+3,0,0
	FCAL	LOGOUT,[64],CMP
	SKIPGE	SFMODE
	JRST	CMP.11
	JRST	CMP.12
; 	CAM TOGETHER CONTROL PROGRAM

CAMTGR:
	RELEAS	0,
	LOOK	MCDDB,ERRE		;LOOKUP MC FILE
CAM.1:	PUSHJ	16,MANCOR	;POSITION MANF CORR FILE
	+	I
	SKIPA
	JRST	CAM.1		;EOSF
CAM.2:	FILBUF	MCBUF,MCIN	;FILL MCBUF
	JRST	CAM.4		;PEOF
	MOVE	0,[XWD MCBUF,UCBUF]
	BLT	0,UCBUF+13	;COPY MCBUF TO UCBUF
	MOVE	0,[XWD MCBUF+12,BASDDB+2]
	BLT	0,BASDDB+3	;INSERT OLDFILE IN BASDDB
	RELEAS	6,
CAM.22:	LOOK	BASDDB,ERRP	;
	JSP	A5,USESRC	;GET CORRESPONDING USER FILE
	JRST	CAM.66
	JRST	CAM.5		;FILE DELETED
	JSP	A7,INCREX		;INCREMENT NEW INDEX
	MOVE	CHAR,USEDDB+3
	MOVEM	CHAR,UCBUF+11
	JSP	A7,LOGMSR
	XWD	CAMM,CAMPTR
	XWD	MCBUF+12,MCBUF+13
	XWD	USEDDB+2,USEDDB+3
	XWD	MCBUF+10,MCBUF+11
	FCAL	LOGOUT,[110],CAMM	;
	OUTHED	UCBUF
	PUSHJ	16,COMERG	;CALL COMERG
	+	I
	MOVE	A1,I		;EOF CONDITIONS
	CAIG	A1,1
	JUMPGE	A1,CAM.2
	JRST	CAM.4
CAM.4:
	JRST	CMORE		;NEXT COMMAND STRING
CAM.5:	FCAL	LOGOUT,[54],MESJ;MC SUBFILE DELETED
	FCAL	LOGOUT,[43],MCBUF;OUT MCBUF
CAM.55:
	FLSH	MCIN,1
	JRST	CAM.4		;PEOF
	JRST	CAM.2		;TRY NEXT SUBFILE
CAM.66:	MOVNI	A1,1		;FLUSH MC
	JRST	COM.5


ERRP:	CLRBFI			;CLEAR INPUT BUFFER FOR TTY
	CNVT	BASDDB+2,MESL.1,MESAPS,6
	CNVT	BASDDB,MESL.2,MESAPS,6
	OUTSTR	MESL
	JSP	A1,DIALOG	;TTY DIALOG
	SKIPA
	JRST	CAM.22		;
	JSP	A5,DELET	;DELETE FILE
	JRST	CAM.2		;THIS DECISION IS QUESTIONABLE???
;	COMERG-ONLY CONTROL PROGRAM

COMERX:
	RELEAS	0,
	RELEAS	4,
	LOOK	UCDDB,ERRD	;LOOKUP USER CORRECTION FILE
	LOOK	MCDDB,ERRE	;LOOKUP MC FILE
COM.1:	PUSHJ	16,MANCOR
	+	I
	SKIPA			;EOSF RETURN
	JRST	COM.1		;NORMAL RETURN
COM.2:	PUSHJ	16,UCOR		;POSITION USER FILE
	+	I
	SKIPA			;EOSF
	JRST	COM.2		;NORMAL RETURN
COM.3:
	FILBUF	MCBUF,MCIN	;FILL MCBUF
	JRST	COM.7		;PEOF
	FILBUF	UCBUF,UCIN	;FILL UCBUF
	JRST	COM.6		;PEOF
	JSP	A5,STSYNC	;SYNC FILE HEADERS
		JRST	CAM.4		;PEOF
	JSP	A7,INCREX	;INCREMENT EXTENSION OF NEW FILE
	JSP	A7,LOGMSR	;FORMATTER
	XWD	CMRG,CAMPTR
	XWD	MCBUF+12,MCBUF+13
	XWD	UCBUF+10,UCBUF+11
	XWD	MCBUF+10,MCBUF+11
	FCAL	LOGOUT,[110],CMRG
	OUTHED	UCBUF		;OUPUT SUBFILE HEADER
	PUSHJ	16,COMERG	;CALL COMERG
	+	I
	MOVE	A1,I		; EOF CONDITIONS
	MOVE	A1,I		;EOF CONDITIONS
	CAIN	A1,0	;EOSF ON BOTH=0
	JRST	COM.3		;TRY NEXT SUBFILE
COM.5:
	CAIN	A1,2		; PEOF BOTH ?
	JRST	CMORE		;YES
	FCAL	MRGOUT,[0],[55]	; SUPPLY MISSING "-"
		CAIGE	A1,0		;-1
	JSP	A5,FLU.2	;FLUSH MC
	CAIL	A1,0		;UC ?
	JSP	A5,FLM.2	;YES
	JRST	CMORE		; COMERG ALL DONE
COM.7:	MOVNI	A1,1		;FLUSH MC
	JRST	COM.5
COM.6:	MOVEI	A1,1		;FLUSH UC
	JRST	COM.5
INCREX:
	SKIPE	INCOPT		;SHOULD INCREMENT ?
	JRST	0(A7)		;NO
	MOVEI	A2,3		;THIRD DIG OF EXT
	LDB	A1,D1.(A2)	;GET CHAR
	CAIE	A1,137		; LEFT ARROW YET?
	SOJG	A2,.-2		; KEEP LOOKING
	SOJ	A2,
INC.1:	LDB	A1,D1.(A2)	; LOAD REAL BYTE
	CAIL	A1,60		;
	CAILE	A1,71		;IS IT NUMERIC ?
	JRST	0(A7)		;NO-RETURN
	AOJ	A1,		;INCREMENT DIGIT
	DPB	A1,D1.(A2)	;STORE
	SUBI	A1,40		;TO SIXBIT
	DPB	A1,D6.(A2)	;DEPOSIT SIXBIT
	CAIE	A1,32		;CARRY ?
	JRST	0(A7)		;NO-RETURN
	MOVEI	A1,60		;ZERO
	DPB	A1,D1.(A2)	;STORE ZERO
	SUBI	A1,40		;TO SIXBIT
	DPB	A1,D6.(A2)	;DEPOSIT SIXBIT
	SOJGE	A2,INC.1		;INCR NEXT DIGIT
	JRST	0(A7)


;	COMPARE-ONLY MAIN CONTROL ROUTINE

CMPRXC:
	CNVT	USEDDB+2,MESCP1,MESAPS,6
	CNVT	USEDDB+3,MESCP2,MESAPS,3
	CNVT	BASDDB+2,MESCP3,MESAPS,6
	CNVT	BASDDB+3,MESCP4,MESAPS,3
		MOVEI	A1,40		;SPACE
	MOVEI	A2,56		;PERIOD
	DPB	A1,NFPER	;PUT IN SP WHERE PER SHOULD BE
	SKIPE	USEDDB+3	;IS NEW EXT NULL ?
	DPB	A2,NFPER	;PUT IN .
	DPB	A1,OFPER	;OLD FILE-PUT IN SP
	SKIPE	BASDDB+3	;IS OLD FILE EXT NULL ?
	DPB	A2,OFPER	;NO-PUT IN .
	MOVE	A1,MESGCZ	;BYTE POINTER
	MOVEI	A2,31		;LEGTH
	JSP	A7,HEDOUT	;
	SETOM	T2
ALLG:	PUSHJ	16,CBGET
	SKIPG	CHAR
	JRST	0(A5)		;NORMAL RETURN
	MOVEM	CHAR,TEMP	;
	FCAL	MRGOUT,[0],TEMP
	SKIPL	LSTOP		;LSTOPTION ?
		JRST	ALLG
	SKIPE	T2
	JSP	RETURN,LINEIN
	FCAL	LSTOUT,[0],TEMP
	CAIN	CHAR,LF		;IS CHAR LF
	JRST	APT2		;YES
	CAIN	CHAR,FF		;IS CHAR FF ?
	JRST	APT2		;YES
	CAIN	CHAR,VT		;IS CHAR A VT ?
APT2:	SETOM	T2
	JRST	ALLG


HEDOUT:
	SETZ	A4,0
	SKIPE	CAMOPT		;COMPARE ONLY ?
	JRST	PT31		;NO
	SKIPL	LSTOP		;YES
	AOS	A4		;DO NOT LSTOUT
PT31:
	SKIPN	A4		;LSTOUT ?
	JSP	RETURN,LINEIN	;LSTOUT LINENUMBER
	PT32:	ILDB	A3,A1		;GET CHAR
	CAIN	A3,40		;IS IT BLANK
	JRST	PT33		;YES
	FCAL	MRGOUT,[0],A3	;MRGOUT CHAR
	JUMPN	A4,PT33		;LSTOUT ?
	FCAL	LSTOUT,[0],A3	;
PT33:	SOJG	A2,PT32		;GET NEXT
	JRST	0(A7)
;	LINE NUMBER OUTPUT ROUTINE

NUMCNV:	MOVEI	A4,5
	SETZB	A1,A3		;CONVERT BINARY TO ASCII
OVER4:	DIVI	A1,12	;DIVIDE BY 10
	ADDI	A2,60		;ADD 060
	ROTC	A2,-7		;SHIFT
	MOVE	A2,A1		;
	MOVEI	A1,0
	SUBI	A4,1
	JUMPN	A2,OVER4	;
OVER40:	MOVEI	A2,40
	SOJLE	A4,0(CHAR)
	ROTC	A2,-7
	JRST	OVER40
LINEIN:
	MOVEM	RETURN,TEMP4
	MOVE	0,[XWD A1,SAV4]
	BLT	0,SAV4+3
	MOVEM	CHAR,TEMP3
	AOS	LINENO	;INCREMENT LINENO
	MOVE	A2,LINENO;
	JSP	CHAR,NUMCNV	;CONVERT TO ASCII
	FCAL	LSTOUT,[5],A3
	FCAL	LSTOUT,[2],PTSPSP
	SETZM	T2
	MOVE	0,[XWD SAV4,A1]
	BLT	0,A4
	MOVE	CHAR,TEMP3
	JRST	@TEMP4
	END	CSTART