/3 TTY HANDLER FOR BUILD
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1974,1975,1977 BY DIGITAL EQUIPMENT CORPORATION
/
/
/
/
/
/
/
/
/
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE
/AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
/CORPORATION.  DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/FOR ANY ERRORS THAT MAY APPEAR IN THIS DOCUMENT.
/
/THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FURNISHED TO THE PURCHASER
/UNDER A LICENSE FOR USE ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED
/(WITH INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH
/SYSTEM, EXCEPT AS MAY OTHERWISE BE PROVIDED IN WRITING BY DIGITAL.
/
/DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY FOR THE USE
/OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY
/DIGITAL.
/
/
/
/
/
/
/
/
/
/
	*0
	-1
DEVICE AS33;DEVICE TTY;0;1;ZBLOCK 2

	TTYVERSION="A&77

/V3 FIXES:

/1.	NOW RECOGNIZES PARITY ^Z ON OUTPUT
/2.	NOW RECOGNIZES ^Z ON OUTPUT EVEN IF NOT
/	FOLLOWED BY 0'S
/3.	VERSION # IS NOW 1.

	*200
	/TELETYPE HANDLER - NOT VERY INTELLEGENT.
	/ONLY RECOGNIZES ^Z AND ^C ON INPUT
	/AND ^C AND ^O ON OUTPUT
	/OH WELL, WHAT CAN YOU EXPECT IN ONE PAGE.
	/ THE LOGIC IS VERY SIMILIAR TO THE PTR AND PTP HANDLERS.
TTY360,	360		/MUST BE FIRST LOC ON PAGE!
TTY,	TTYVERSION
TT7600,	7600
	RDF
	TAD TTYCIF
	DCA TTYXIT	/SAVE RETURN FIELD
	TAD I TTY
	AND TT70
	TAD TTCDF
	DCA TTYCDF	/DATA FIELD OF BUFFER
	CLA CLL CML RAR
	TAD I TTY
	AND TT3700
	CMA
	DCA TTYWC
	ISZ TTY
	TAD I TTY
	DCA TTYCA	/SAVE BUFFER ADDRESS
	ISZ TTY
	ISZ TTY
	JMP TTKLG
TTYLP,	SNL CLA
	JMP TTYGLP	/ZER LINK MEANS READ
	JMS TTYTST	/TEST FOR ^C
	TAD TTYM14	/-203-14=-217 =-"^O"
	SNA CLA
	JMP TTYCTO
	TAD I TTYCA	/CHARACTER 1 IS LOW ORDER 8 BITS OF WORD 1
	JMS TTYPCH
	DCA TTYGCH
	ISZ TTYCA
TT7400,	7400
	TAD I TTYCA	/CHARACTER 2 IS LOW ORDER 8 BITS OF WORD 2
	JMS TTYPCH
	CLL RTR
	RTR
	TAD TTYGCH
	CLL RTR
	RTR		/CHARACTER 3 IS HIGH ORDER 4 BITS OF WORDS 1 AND 2
	JMS TTYPCH	/WILL SET LINK ON!
TTLOOP,	ISZ TTYCA	/AC HAPPENS TO BE ZERO HERE
TT70,	70
TTKLG,	ISZ TTYWC
	JMP TTYLP
TTYRTN,	TAD TTYCDF
	CLL CIA
	SNL CLA
	ISZ TTY		/SKIP PAST ERROR RETURN
TTYXIT,	HLT		/RESTORE CALLING FIELDS
	RAL
	JMP I TTY
TTYPCH,	0		/MUST SET LINK ON!
	DCA TTYTST
	TAD TTYTST
	TAD TTYM32	/ONLY CARE IF LOW ORDER 7 BITS ARE -32
	AND TTY177	/SO ONLY LOOK AT THESE BITS
	SNA CLA
	JMP TTYRTN	/WAS A ^Z
	TAD TTYTST	/GET BACK ALL 12 BITS
	JMS TTPRNT
	AND TT7400	/BUT RETURN ONLY LEFT THIRD
	STL		/**** CRUD
	JMP I TTYPCH
TTY212,	212
	IFNZRO .-TTY360-100	<ER3700,QQQQ>
TTYCA,	0
TTYWC,	0
TTYTST,	0
TTYCDF,	0
	TAD TTY200
	KRS		/TEST FOR ^C WITH FLAG UP
	TAD TTM203
	SNA
	KSF
	JMP I TTYTST
TTYCIF,	CDF CIF 0
	JMP I TT7600
TTPRNT,	0
	TLS
	TSF
	JMP .-1
	JMP I TTPRNT
TTCDF,	CDF 0

/FOLLOWING CODE READS TTY AND PACKS IN BUFFER.
TTYGLP,	JMS TTYGCH
	DCA I TTYCA
TTYM32,	JMS TTYGCH
	DCA TTYPCH
	JMS TTYGCH
	RTL
	RTL
	DCA TTYGCH
	TAD TTYGCH
	AND TT7400
	TAD I TTYCA
TT3700,	DCA I TTYCA
	TAD TTYGCH
TTY200,	AND TTY360
	CLL RTL
	RTL		/CLEARS LINK
	TAD TTYPCH
	ISZ TTYCA
	DCA I TTYCA
	JMP TTLOOP
	IFNZRO .-TTY360-146 <TTYERR,QQQQQ>
TTYGCH,	0		/MUST BE AT REL LOC 146
	TAD TTYCDF
TT7700,	SMA CLA
	JMP I TTYGCH
	ISZ TTYTST
	JMP TTYKSF
	TAD TTY212
	JMP TTECHO
TTYKSF,	KSF
	JMP .-1
	JMS TTYTST
	TAD TTM27
	SNA		/IS IT A ^Z?
	DCA TTYCDF	/YES - SET END-OF-FILE FLAG
	TAD TTY14
	DCA TTYTST	/TTYTST=-1 IF CARRIAGE RETURN
	KRB
TTECHO,	JMS TTPRNT	/ECHO THE INPUT CHARACTER
	JMP I TTYGCH
TTM203,	-203
TTM27,	-27
TTYM14,	-14
TTY177,	177
	IFNZRO .-TTY360-175 <NICE,QQ>
TTYCTO,	6032		/SHOULD BE AT REL LOC 175 FOR PATCHERS
	JMP TTYRTN
TTY14,	14
	$

