Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50146/tty.mac
There are 2 other files named tty.mac in the archive. Click here to see a list.
	TITLE	TTY (ROUTINES FOR CONSOL TELETYPE SERVICE)	VERSION #2	SEPT. 1 '69
SUBTTL	DAVE MCCLURE'S MODIFICATIONS TO ORIGINAL BY DON WITCRAFT	(JULY 1969)


;KEYBOARD DATA BLOCK

ENTRY KDATA

KDATA:	EXP	4*^D100000	;10 CPS
	4*^D100000		;TRY FOR THE FIRST CHAR IN .1 SECONDS
	XWD	KACTIV,KFLG
	XWD	400000,GETCHR	;ROUTINE TO CALL WHEN DEVICE TIME OUT


KIB:	0			;KEYBOARD INPUT BUFFER

;KEYBOARD IOTS

INTERNAL KSF,KCC,KRS,KRB
EXTERNAL NTIME,TIME,DRDATA,ALPHA


KSF:	TRNE FLAGS,KFLG		;<6031> SKIP ON KEYBOARD FLAG.
	AOS PC			;<6032> FLAG IS ON. SKIP.
	POPJ PDP,

KCC:	SETZM AC		;CLEAR KEYBOARD FLAG
KCC1:	TRZ FLAGS,KFLG		;0=>AC.0=>KEYBOARD FLAG
	POPJ PDP,

KRS:	OR AC,KIB		;<6034> READ KEYBOARD BUFFER STATIC
	JRST KCC1

KRB:	MOVE AC,KIB		;<6036> READ KEYBOARD BUFFER DYNAMIC
	JRST KCC1

,GETCHR IS CALLED WHEN KEYBOARD IS ACTIVE AND KTIME GOES NEGATIVE.

GETCHR:	SETZM	AC2		;ZERO WORD TO AVOID CONFUSION
	INCHRS	AC2		;TRY TO PICK UP A CHARACTER
	JRST	NODATA		;NO CHARACTER WAS PRESENTED
	CAIN	AC2,136		;WAS CHARACTER A "^"?
	JRST	INTERRUPT	;YES SO TELL DRIVER
RECVD:	TRO	FLAGS,KFLG	;CHARACTER RECEIVED SO SET FLAG
	IORI	AC2,200		;ADD LEADING BIT TO CHAR
	MOVEM	AC2,KIB
	JRST	.+2		;SET ACTIVE AGAIN
NODATA:	TRZ	FLAGS,KFLG	;TURN OFF KEYBOARD FLAG
	TLOE	FLAGS,KACTIV	;SET KEYBOARD ACTIVE
	JRST	EXIT		;ALREADY TIMING OUT SO EXIT
	HALT
EXIT:	POPJ PDP,
INTERR:	INCHRW	AC2	;GET THE NEXT CHARACTER
	CAIN	AC2,136		;ALSO A "^"?
	JRST	RECVD		;YES SO IT WAS A "^"
	PUSHJ	PDP,ALPHA+4	;CHECK TO SEE IF IT WAS ALPHABETIC
	JRST	.+3		;IT WASN'T
	SUBI	AC2,100		;CONVERT IT TO A CONTROL CHAR.
	JRST	RECVD
	CAIN	AC2,137		;"_"
	JRST	.+3		;YES SO INTERRPRET AS A RUBOUT
	SETZM	DRDATA+1	;HAVE THE DRIVER INTERRUPT
	JRST	NODATA		;NOTE THAT NO DATA RECIEVED
	MOVEI	AC2,377		;RUBOUT
	JRST	RECVD		;NOTE WE GOT A CHAR



;TELEPRINTER DATA BLOCK

ENTRY TDATA

TDATA:	EXP	4*^D100000	;10 CPS
	Z
	XWD	TACTIV,TFLG
	Z

TOB:	0			;TELEPRINTER BUFFER

;TELEPRINTER IOTS

INTERNAL TSF,TPC,TCF,TLS
EXTERNAL FCLOSE,NTIME,TIME

TSF:	TRNE	FLAGS,TFLG	;<6041> SKIP ON TELEPRINTER FLAG.
	AOS	PC
	POPJ	PDP,

TLS:	TRZ	FLAGS,TFLG	;<6046>
;<6044> LOAD TELEPRINTER BUFFER, SELECT AND PRINT
TPC:	MOVE	AC0,AC		;LOAD CHARACTER FROM THE AC
	ANDI	AC0,377		;REDUCE TO 8BITS
	MOVEM	AC0,TOB
	TLO	FLAGS,TACTIV	;SET TELEPR ACTIVE FLAG
	MOVE	AC1,TIME
	ADD	AC1,TDATA	;ADD DELAY TIME
	MOVEM	AC1,TDATA+1	;SET TIME TO RAISE FLAG
	CAMGE	AC1,NTIME	;NEXT FLAG TO SET?
	MOVEM	AC1,NTIME	;YES
	MOVE	AC0,AC		;LOAD CHARACTER TO BE TYPED
	ANDI	AC0,377		;REDUCE TO 8 BITS
	OUTCHR	AC0		;TYPE IT
	POPJ	PDP,		;EXIT

TCF:	TRZ	FLAGS,TFLG		;<6042> CLEAR TELEPRINTER FLAG.
	POPJ	PDP,

TTOB:	BLOCK 3

	END