Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-07 - decus/20-0168/echo.mac
There are 3 other files named echo.mac in the archive. Click here to see a list.
	TITLE ECHO, VERSION-5, EDIT-7
	SUBTTL WRITTEN BY BOB CONLON 01-MAR-78, MODIFIED 13-MAY-81

	;MACRO SUBROUTINE FOR DECSYSTEM-20 USED TO TURN TTY ECHO ON/OFF FOR
	;TTY USERS.

	ENTRY NAMDAT
	ENTRY TRAPC
	ENTRY ECHO
	ENTRY OFECHO
	ENTRY INIT
	ENTRY DATCHK
	ENTRY NOECHO
	ENTRY APR
        ENTRY EXIT1
	ENTRY PPNO
	INTERN GETPW, GOTPW, NOTSPW, USPWDN, SAVACS, ERBLK, ERROUT
	INTERN ECHON, RESACS, OCTDEC, OD001, OD001A, OD002, PW, SAVE
	INTERN PRVIND, TAGADR, PRIV.1, USRPWD
	INTERN WDSBEF, KEYWDS, WDSAFT, FMTWDS, AUDKEY, AUDAFT
	INTERN SCRREC,UNSSCR,FMTCNV,NOTFMT,NOTAUD,DOREST,UNKNOW,DOSCR

	;THIS ROUTINE WILL HANDLE A ^C INTERCEPT WITHOUT ANY SPECIAL ACTIVITY.
	;ALL THAT OCCURS IS A PUSH OF THE LAST PC ONTO THE STACK AND A RETURN
	;TO THAT PLACE IN THE PROGRAM.

	TRAPC:	PUSHJ 17,SAVACS			;SAVE THE ACS
		MOVEI 1,TRPBLK			;GET ADDR OF ERROR BLOCK
		MOVEM 1,134			;SET UP .JBINT
		PUSHJ 17,RESACS			;RESTORE ACS
		POPJ 17,			;BACK OUT

	ECHO:	PUSHJ 17,SAVACS			;SAVE THE ACS
		PUSHJ 17,ECHON			;TURN ON THE ECHO
		PUSHJ 17,RESACS			;RESTORE THE ACS
		POPJ 17,			;BACK OUT

	OFECHO:	PUSHJ 17,SAVACS			;SAVE THE ACS
		PUSHJ 17,ECHOFF			;TURN OFF THE ECHO
		PUSHJ 17,RESACS			;RESTORE THE ACS
		POPJ 17,			;AND BACK OUT

	NAMDAT:	PUSHJ 17,SAVACS			;SAVE THE ACS
		CALLI 1,14			;GET TODAY'S DATE
		CAMG 1,DATHLD			;DATE > XPD?
		JRST CHK30			;NO, SEE IF WITHIN 30 DAYS
		OUTSTR [ASCIZ /?CSSDBM E X P I R E D CONTACT BOB CONLON X 3630/]
		OUTSTR CR
		EXIT

	CHK30:	MOVE 2,DATHLD			;GET XPD DAYS IN 1
		SUBI 2,^D30			;SET DOWN BY 30 DAYS
		CAMG 1,2			;DATE > XPD-30 DAYS?
		JRST DCKDON			;NO CONTINUE PROCESS
		OUTSTR CR
		OUTSTR [ASCIZ /%CSSDBM WILL BE SUSPENDED WITHIN 30 DAYS/]
		OUTSTR CR
		OUTSTR [ASCIZ /CONTACT BOB CONLON AT X3-3630 FOR CONTRACT RENEWAL/]
		OUTSTR CR

	DCKDON:	PUSHJ 17,RESACS			;RESTORE ACS
		POPJ 17,			;RETURN
	DATCHK:	POPJ 17,			;RETURN


	INIT:	PUSHJ 17,SAVACS			;SAVE THE ACS
		HRRZ 1,@16			;GET ADDR OF FIELD1 IN 1
		HRRZ 2,@1			;GET VALUE OF FIELD1 IN 2
		MOVEM 2,WDSBEF			;STORE # WDS BEFORE KEY
		AOS 16				;INCREMENT TABLE ADDR
		HRRZ 1,@16			;GET ADDR OF FIELD2 IN 1
		HRRZ 2,@1			;GET VALUE OF FIELD2 IN 2
		MOVEM 2,KEYWDS			;STORE # WDS IN KEY
		AOS 16				;INCREMENT TABLE ADDR
		HRRZ 1,@16			;GET ADDR OF FIELD3 IN 1
		HRRZ 2,@1			;GET VALUE OF FIELD3 IN 2
		MOVEM 2,WDSAFT			;SAVE # WORDS AFTER KEY
		PUSHJ 17,RESACS			;RESTORE THE ACS
		POPJ 17,			;RETURN TO COBOL PROGRAM

	SCRREC:	PUSHJ 17,SAVACS			;SAVE THE ACS
		MOVE 4,[ROT 3,3]		;LOAD FUNCTION
		PUSHJ 17,FMTCNV			;DO CONVERSION
		PUSHJ 17,RESACS			;RESTORE THE ACS
		POPJ 17,			;BACK TO THE COBOL PROGRAM

	UNSSCR:	PUSHJ 17,SAVACS			;SAVE THE ACS
		MOVE 4,[ROT 3,-3]		;LOAD FUNCTION
		PUSHJ 17,FMTCNV			;DO CONVERSION
		PUSHJ 17,RESACS			;RESTORE THE ACS
		POPJ 17,			;BACK TO THE COBOL PROGRAM

	FMTCNV:	HRRZ 1,@16			;GETS ADDR OF RECORD TYPE IN 1
		HRRZ 5,@1			;GET RECORD TYPE IN 5
		AOS 16				;INCREMENT TAB ADDR FOR RECORD
		HRRZ 1,@16			;GETS ADDR OF BPTR OF RECORD
		HRRZ 2,@1			;GETS START ADDR OF REC IN 2
		CAIE 5,0			;IS RECORD A FMT 
		JRST NOTFMT			;NO
		MOVE 1,FMTWDS			;GET # WORDS IN FMT TO 1
		PUSHJ 17,DOSCR			;SCRAMBLE
		POPJ 17,			;RETURN

	NOTFMT:	CAIE 5,2			;IS RECORD TYPE AUDIT?
		JRST NOTAUD			;NO
		ADD 2,AUDKEY			;BE SURE TO SKIP THE KEY
		MOVE 1,AUDAFT			;MOVE # WORDS AFTER KEY TO 1
		PUSHJ 17,DOSCR			;SCRAMBLE
		POPJ 17,			;RETURN TO CALLER

	NOTAUD:	CAIE 5,1			;IS RECORD TYPE DB
		JRST UNKNOW			;NOPE
		MOVE 1,WDSBEF			;GET # WDS BEF KEY IN 1
		JUMPE 1,DOREST			;JUMP IF NO WORDS
		PUSHJ 17,DOSCR			;SCRAMBLE

	DOREST:	ADD 2,KEYWDS			;SKIP THE KEY
		MOVE 1,WDSAFT			;WORDS AFTER KEY
		PUSHJ 17,DOSCR			;SCRAMBLE
		POPJ 17,			;RETURN

	UNKNOW:	OUTSTR [ASCIZ /UNKNOWN RECORD TYPE
/]
		EXIT

	DOSCR:	MOVE 3,@2			;GET A WORD FROM REC TO 3
		XCT 4				;ROTATE
		MOVEM 3,@2			;PLACE BACK INTO RECORD
		AOS 2				;INCREMENT REC ADDR
		SOSG 1				;DECREMENT WORD COUNT
		POPJ 17,			;NO MORE TO DO
		JRST DOSCR			;DO ANOTHER

	NOECHO:	PUSHJ 17,SAVACS			;SAVE ALL ACS
		MOVEI 1,ERBLK			;MOVE TRAP ADDR TO 1
		MOVEM 1,134			;AND OUT TO .JBINT
		HRRZ 1,@16			;GET ADDR OF PRIV IND
		MOVEM 1,PRVIND			;AND SAVE IT
		MOVE 1,@PRVIND			;GET CONTENT OF PROMPT-IND
		MOVEM 1,DBWFLG			;SAVE FOR CSSDBW CHECK
		AOS 16				;INCREMENT ADDR
		HRRZ 1,@16			;GET ADDR OF GOOD CODE RETURN PC
		MOVEM 1,TAGADR			;SAVE FOR LATER
		AOS 16				;INCREMENT ADDR
		HRRZ 1,@16			;GET ADDR OF PRIV(1) BPNT
		MOVE 2,@1			;GET BPNT OF PRIV(1)
		MOVEM 2,PRIV.1			;SAVE TILL LATER
		AOS 16				;INCREMENT ADDR
		HRRZ 1,@16			;GET ADDR OF USER-PASSWORD BPNT
		MOVE 2,@1			;AND GET THE BPNT
		MOVEM 2,USRPWD			;STORE TILL LATER
		AOS 16				;INCREMENT TABLE ADDR
		HRRZ 1,@16			;GET ADDR OF SPC BPTR
		MOVE 2,@1			;GET SPC BPTR IN 2
		MOVEM 2,SPCPTR			;SAVE TILL LATER
		PUSHJ 17,ECHOFF			;TURN OFF ECHO
		OUTSTR [ASCIZ /PASSWORD:  /]
		SETZ 4,				;ZERO 4
		MOVE 2,[POINT 6,4]		;SETUP USER PASSWORD BPNT
		MOVN 3,[6]			;SETUP CHAR COUNT
		CLRBFI				;CLEAR INPUT BUFFER

	GETPW:	INCHWL 1			;GET USER PASSWORD
		CAIN 1,15			;IS IT <CR>?
		JRST GOTPW			;YES
		AOJG 3,GOTPW			;ARE THERE MORE THAN 6 CHARS?
		SUBI 1,40			;CONVERT TO SIXBIT
		IDPB 1,2			;DEPOSIT
		JRST GETPW			;LOOP BACK

	GOTPW:	PUSHJ 17,ECHON			;TURN ECHO BACK ON
		OUTSTR CR			;OUTPUT A CR LF
		CLRBFI				;CLEAR INPUT BUFFER
		CLRBFO				;CLEAR OUTPUT BUFFER
		JUMPN 4,.+2				;WAS A NULL PW ENTERED?
		EXIT				;YES
		CAME 4,PW			;IS IT GOOD PW
		JRST NOTSPW			;NO
		MOVEI 1,1			;PREPARE TO SET PRIV-IND
		MOVEM 1,@PRVIND			;MOVE IT
		MOVEI 1,20			;PREPARE TO SET PRIV
		IDPB 1,PRIV.1			;DEPOSIT A SIXBIT 0
		IDPB 1,PRIV.1			;ANOTHER 0
		MOVEI 1,23			;LOAD A SIXBIT 3
		IDPB 1,PRIV.1			;DEPOSIT
		MOVE 1,DBWFLG			;SEE IF ENTRY FROM CSSDBW
		CAIE 1,7			;IS IT CSSDBW?
		JRST NOTDBW			;NO
		OUTSTR CR			;OUTPUT A <CR>
		OUTSTR [ASCIZ /ENCRYPT DATA: /]
		INCHWL 1			;GET SPC
		SUBI 1,40			;CONVERT TO 6 BIT
		IDPB 1,SPCPTR			;MOVE IT TO SPC
		CLRBFI

	NOTDBW:	POP 17,				;POP OLD RETURN FROM STACK
		PUSH 17,TAGADR			;PLACE RETURN ADDR ON STACK
		PUSHJ 17,RESACS			;RESTORE ACS
		POPJ 17,			;SPECIAL RETURN

	NOTSPW:	MOVEI 3,6			;SET BYTE COUNT
		SETZ 5,				;ZERO TEMP AC
		MOVE 2,[POINT 6,4]		;PREPARE TO GET PW FROM 4
		ILDB 5,2			;GET A BYTE
		IDPB 5,USRPWD			;DEPOSIT
		SOJLE 3,USPWDN			;JUMP IF DONE
		JRST NOTSPW+3			;GO GET MORE

	USPWDN:	PUSHJ 17,ECHON			;TURN ECHO BACK ON
		PUSHJ 17,RESACS			;RESTORE ACS
		POPJ 17,			;RETURN TO COBOL


	APR:	POPJ 17,			;ALL DONE

	PPNO:	PUSHJ 17,SAVACS			;SAVE THE ACS
		MOVE 1,@16			;GET ADDR OF ADDR OF USER-PPN
		MOVE 2,@1			;GET ADDR OF USER-PPN
		CALLI 2,24			;GET MY PPN
		MOVEM 2,@1			;RESTORE MY PPN
		PUSHJ 17,RESACS			;RESTORE THE ACS
		POPJ 17,			;BACK TO COBOL

	EXIT1:	EXIT				;RETURN TO AVOID AUD ERRORS

	TRPBLK:	4,TRPCON			;4 WDS,SRTN AT TRPCON
		XWD 0,2				;NO MESSAGE,,TRAP ^C
		Z				;GETS LAST PC
		Z				;LH GETS INTERRUPT TYPE

	TRPCON:	PUSH 17,TRPBLK+2		;PUT LAST PC ONTO STACK
		SETZM TRPBLK+2			;ZERO OUT FOR NEXT ^C
		POPJ 17,			;BACK TO LAST PC


	SAVACS:	MOVEM 16,SAVE+16		;SAVE AC16
		MOVE 16,[XWD 0,SAVE]		;BOTH START ADDR
		BLT 16,SAVE+15			;XFER
		MOVE 16,SAVE+16			;RESTORE AC16
		POPJ 17,			;RETURN

	ERBLK:	4,ERROUT			;4 WORDS,,AT ERROUT
		XWD 0,2				;NO MONITOR MESSAGE,,TRAP ^C
		Z				;LAST USER PC
		Z				;LH GETS INTERRUPT TYPE

	ERROUT:	PUSHJ 17,ECHON			;GO TURN ECHO BACK ON
		PUSH 17,ERBLK+2			;PUSH NEXT PC ONTO STACK
		SETZM ERBLK+2			;SET FOR NEXT ^C
		EXIT 1,				;EXIT TO MONITOR
		POPJ 17,			;RETURN TO LAST PC IF CONT

	ECHON:	SETO 1,				;MOVE ONES TO 1
		GETLCH 1			;GET LINE CHARACTERISTICS
		TLZ 1,000004			;SET ECHO BIT ON
		SETLCH 1			;TELL MONITOR
		POPJ 17,			;RETURN

	RESACS:	MOVE 16,[XWD SAVE,0]		;STARTING ADDR OF SOURC E AND DEST
		BLT 16,15			;XFER
		MOVE 16,SAVE+16			;RESTORE ORIGINAL 16
		POPJ 17,			;RETURN

	OCTDEC:	SETZ 4,				;ZERO DIGIT COUNT
		IDIVI 1,12			;DIVIDE BY BASE
		PUSH 17,2			;PUSH REMAINDER ONTO STACK
		AOS 4				;INCREMENT DIGIT COUNT
		JUMPE 1,OD001			;JUMP OF DONE
		JRST OCTDEC+1			;LOOP BACK FOR MORE

	OD001:	CAIE 4,1			;HAS ONLY 1 DIGIT BEEN FACTORED?
		JRST OD001A			;NO
		MOVEI 5,20			;PREPARE TO LEFT ZERO FILL
		IDPB 5,3			;SEND LEFT ZERO OUT

	OD001A:	SOJL 4,OD002			;DECREMENT DIGIT COUNT
		HRRZ 5,(17)			;GET VALUE FOR STACK
		ADDI 5,20			;MAKE IT SIXBIT
		IDPB 5,3			;DEPOSIT THE BYTE
		POP 17,				;POP THE STACK
		JRST OD001A			;LOOP BACK

	OD002:	POPJ 17,			;RETURN

	ECHOFF:	SETO 1,				;PREPARE TO TUN OFF ECHO BIT
		GETLCH 1			;GET LINE CHARACTERISTICS
		TLO 1,000004			;SET ECHO BIT OFF
		SETLCH 1			;TELL MONITOR
		POPJ 17,			;BACK OUT

	PW:	SIXBIT /AUDIT1/
	CR:	ASCIZ /
/
	SAVE:	BLOCK ^D16			;STORAGE OF ACS

	DATHLD:	^D9672				;01-JAN-90

	PRVIND:	Z				;ADDR OF PRIV-IND

	TAGADR:	Z				;ADDR OF GOOD PW RETURN PC

	PRIV.1:	Z				;BYTE POINTER FOR PRIV(1)

	USRPWD:	Z				;BYTE POINTER OF USER-PASSWORD

	WDSBEF:	Z				;# WORDS BEFORE DB KEY

	KEYWDS:	Z				;# WORDS KEY OCCUPIES

	WDSAFT:	Z				;# WORDS AFTER KEY

	FMTWDS: ^D672				;NUMBER OF WORDS IN FORMAT REC

	AUDKEY:	3				;NUMBER OF WORDS IN AUD KEY

	AUDAFT: ^D20				;NUMBER OF WORDS AFT AUD KEY

	SPCPTR:	Z				;BYTE POINTER FOR SPC

	DBWFLG:	Z				;SAME AS PRVIND (CSSDBW)

	END