	.TITLE *** DEFINE TERMINAL CHARACTERISTICS MCR FUNCTION ***

/ 

/ 

/                   FIRST PRINTING, FEBRUARY 1974

/ 

/ 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 RESPON-

/ SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS

/ DOCUMENT.

/ 

/ THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-

/ NISHED 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 PRO-

/ VIDED IN WRITING BY DIGITAL.

/ 

/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY

/ FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-

/ MENT THAT IS NOT SUPPLIED BY DIGITAL.

/ 
/ COPYRIGHT (C) 1976, BY DIGITAL EQUIPMENT CORPORATION

/ 

/ 

        .EJECT

/

/ EDIT #5	M. HEBENSTREIT		OCT. 23 1974
/ EDIT #6	SCR			MAR 16 1976
/ EDIT #7	SCR			APR 1 1976
/
/ DATA BITS ARE TO BE PUT INTO TTWD00

/

/ 14000 FOR UNIT TYPE

/

/	0     KSR35

/	4000  KSR33

/	10000 LA30

/	14000 VT05

/

/

/ 3000 FOR BAUD

/

/ 400 SAYS PRINT ALT-MODES

/

/

/

/ THIS MCR FUNCTION IS USED TO DEFINE THE TERMINAL CHARACTERISTICS OF

/ TELETYPES IN AN RSX SYSTEM. THE COMMAND FORMAT IS AS FOLLOWS:

/

/	MCR>DTC TT# NAME (BAUD)$

/

/ WHERE TT# IS THE TELETYPE IDENTIFIER (# IS A 1 OR 2 CHARACTER OCTAL

/ NUMBER), NAME IS THE NAME OF THE DEVICE (KSR33,KSR35,LA30,GT40, VT05,

/ VT50, OR LA36)

/ BAUD IS THE BAUD RATE IN DECIMAL (ONLY GIVEN FOR LA30, VT50, OR VT05)

/ THE BAUD RATE CAN TAKE ON THE FOLLOWING VALUES:

/	LA30: 300 OR SOME NUMBER LESS THAN 300

/	VTO5: 2400, 1200, 600, OR SOME NUMBER LESS THAN 600

/	VT50: 2400, 1200, 600, OR SOME NUMBER LESS THAN 600

/	LA36: NO BAUD RATE SPECIFICATION IS NEEDED FOR THIS DEVICE

/ $ INDICATES THE LINE TERMINATOR.

/

/

FAC=174

MCRRI=171

.ENB=705521

.INH=705522

IDX=ISZ

/

START	DZM	BITS		/(006)DEFAULT TO KSR35

	JMS	CHART		/IS THIS CHAR. A T?

	124

	JMS	CHART		/YES -- IS THIS CHAR. A T?

	124

	JMS*	(FAC		/GET NEXT CHAR.

	JMS	UNUM		/GET A NUMBER (OCTAL)

	DAC	UNIT		/AND SAVE AS A PARTITAL UNIT NO.

	JMS*	(FAC		/GET NEXT CHAR.

	SAD	(40		/IS IT A SPACE?

	JMP	LOC1		/YES -- THEN WE HAVE THE UNIT NO.

	JMS	UNUM		/NO -- GET THE NUMBER

	DAC	TEMP

	LAC	UNIT		/CONSTRUCT A 2 CHAR UNIT NO.

	ALS	3

	TAD	TEMP

	DAC	UNIT		/SAVE THE UNIT NO.

	JMS*	(FAC		/GET NEXT CHAR.

	SAD	(40		/IS IT A SPACE?

	SKP			/YES

	JMP	ERR1		/NO -- ERROR

LOC1	LAC*	(176		/GET THE NO. OF TTY'S IN SYSTEM

	TCA

	TAD	UNIT
	SMA			/(007)OFF BY 1 BUG REPRTED BY SPR
	JMP	ERR2		/NO -- ERROR
	LAC*	(202		/(006)TTWD00 ADDR FOR UNIT 0

	TAD	UNIT

	DAC	TTWD0

/

	JMS*	(FAC		/GET THE NEXT CHAR. AND PREPARE TO

				/DISPATCH TO PROPER ROUTINE.

	SAD	(40		/WAS CHAR A SPACE?

	JMP	.-2		/YES -- READ NEXT CHAR.

	SAD	(107		/NO -- A G?

	JMP	G		/YES -- GT40?

	SAD	(113		/NO -- A K?

	JMP	K		/YES -- KSR33 OR KSR35?

	SAD	(114		/NO -- AN L?

	JMP	L		/YES -- LA30?

	SAD	(126		/NO -- A V?

	SKP			/YES -- VT05?

	JMP	ERR1		/NO -- ERROR

/

V	JMS	CHART		/IS NEXT CHAR A T?

	124

	JMS*	(FAC		/YES -- GET THE NEXT CHARACTER

	SAD	(60		/IS IT A ZERO?

	JMP	VT0		/YES -- PROBABLY A VT05

	SAD	(65		/NO -- IS IT A FIVE?

	SKP

	JMP	ERR1		/NO -- ERROR

	JMS	CHART		/YES -- IS NEXT CHAR. A ZERO?

	60

	JMP	VT05		/YES -- TREAT VT05'S AND VT50'S THE SAME

/

VT0	JMS	CHART		/IS NEXT CHAR A 5?

	65

VT05	JMS	NUMBER		/YES -- GET THE BAUD RATE

	JMP	ERR1		/RETURN HERE ON ERRORS

	DAC	TERM		/RETURN HERE IF OK -- SAVE BREAK

	LACQ			/GET BAUD RATE INTO AC

	TAD	DM600		/>,=,< THAN 600 BAUD

	SMA!SZA!CLL!CML		/SKIP <=, LINK FLAG, GET BAK ORIG

	LACQ			/NOT YET OK, DO SAD'S

	SNA			/\SKIP <>

	CLA!CLL!IAC		/\BUILD CODE IN RIGHT HALF WORD

/				/LINK SAYS WE'RE OK

	SPA

	CLA!CLL			/MINUS IS <600 CODE 0

	SAD	D1200

	TAD	(2-2260		/CODE, CLEAR LINK TO SAY OK

	SAD	D2400

	TAD	(3-4540		/CODE, CLEAR LINK TO SAY OK

	SZL!SWHA		/SKIP IF OK, SHIFT INTO PLACE

	JMP	ERR4		/ILLEGAL BAUD RATE -- ERROR

	TAD	(14000		/ENTER WITH BAUD BITS, HERE'S DEVICE

	JMP	EXITAC		/AC HAS BITS, GO!

/

G	JMS	CHART		/IS NEXT CHAR A T?

	124

	JMS	CHART		/YES -- IS NEXT CHAR A 4?

	64

	JMS	CHART		/YES -- IS NEXT CHAR A 0?

	60

	LAC	(400		/ALT SET BITS, KSR35 UNIT TYPE

	JMP	KSR33		/GO TO KSR33 TO SET BITS

/

L	JMS	CHART		/IS NEXT CHAR AN A?

	101

	JMS	CHART		/YES -- IS NEXT CHAR A 3?

	63

	JMS*	(FAC		/YES -- GETD THE NEXT CHARACTER

	SAD	(60		/IS IT A ZERO?

	JMP	LA30		/YES -- DEVICE IS AN LA30

	SAD	(66		/NO -- IS IT A SIX?

	JMP	KSR330		/YES -- TREAT LA36'S AS KSR33'S

	JMP	ERR1		/NO -- ERROR

LA30	JMS	NUMBER		/YES -- GET THE BAUD RATE

	JMP	ERR1		/RETURN HERE ON AN ERROR

	DAC	TERM		/RETURN HERE IF OK -- SAVE BREAK CHAR

	LACQ			/GET BAUD RATE INTO AC

	TAD	MD300		/MINUS DECIMAL 300

	SMA!SZA			/IF BAUD >300 ILLEGAL

	JMP	ERR4

	SNA!CLA			/LESS THAN 300 GIVES 00

	LAC	(1000		/300 EVEN GIVES 1000

	TAD	(10000		/LA30 TYPE

EXITAC	DAC	BITS		/SAVE TYPE

	JMP	LEVEL3		/RAISE TO LEVEL THREE TO SET

/

K	JMS	CHART		/IS NEXT CHAR AN S?

	123

	JMS	CHART		/YES -- IS NEXT CHAR AN R?

	122

	JMS	CHART		/YES -- IS NEXT CHAR A 3?

	63

	JMS*	(FAC		/YES -- WHAT IS THE NEXT CHAR?

	SAD	(65		/NO -- A 5?

	JMP	KSR35		/35 ZERO BITS ALL SET

	SAD	(63		/A 3?

	SKP			/YES IS A KSR33

	JMP	ERR1		/NO -- ERROR

KSR330	LAC	(4000		/KSR33 TYPE

KSR33	DAC	BITS		/SAVE TYPE

KSR35	JMS*	(FAC		/PICK UP THE FINAL (?) CHAR

	DAC	TERM		/SAVE TERMINATOR (?)

LEVEL3	LAC	(400020

	ISA

	LAC*	TTWD0		/WORD0

	XOR	BITS		/JAM IN OUR DATA

	AND	(760377		/1'S GIVE TTWD00, 0'S GIVE BITS

	XOR	BITS

	DAC*	TTWD0

	DBK			/OUT OF THREE

/

EXIT	LAC	TERM		/FIND THE REAL LINE TERM.

	SAD	(15

	JMP	EXITCR

	SAD	(175

	JMP	EXITAM

	JMS*	(FAC

	JMP	EXIT+1

EXITCR	CAL	REQMCR

	CAL	(10

EXITAM	DZM*	(MCRRI

	CAL	(10

/

/ SUBROUTINES

/

/ SUBROUTINE CHART -- TEST NEXT CHARACTER

/

/ CALLING SEQ.:		JMS	CHART

/			#

/

/ WHERE # IS THE ASCII YOU WANT TO TEST FOR.

/ RETURN AT JMS+2 IF CHAR IS #, JMP ERR1 IF NOT

/

CHART	0

	JMS*	(FAC

	SAD*	CHART

	SKP

	JMP	ERR1

	IDX	CHART

	JMP*	CHART

/

/ SUBROUTINE UNUM -- GET PART OF AN OCTAL UNIT NO.

/

/ CALLING SEQ.:		LAC 	CHAR	/AC HAS CHARACTER

/			JMS	UNUM

/

/ RETURN AT JMS+1 IF CHAR IS A OCTAL NO. WITH OCTAL IN AC

/ RETURN WITH LINK CLEARED

/ JMP TO ERR1 IF CHAR IS NOT AN OCTAL DIGIT.

/

UNUM	0

	CLL!CML

	AAC	-70

	TAD	(10		/(006)CARRY TO LINK IF RANGE OK!

	SZL			/(006) OK?

	JMP	ERR1

	JMP*	UNUM

/

/

/ SUBROUTINE NUMBER -- READ A DECIMAL NUMBER OF UP TO 4 DIGITS

/			OFF THE MCR TTY.

/ 

/ ALTERED REGISTERS: AC AND MQ

/ 

/ CALLING SEQUENCE:

/		JMS	NUMBER

/		JMP	???	/RETURN HERE IF 1ST CHARACTER

/				/AFTER A BUNCH OF SPACES IS NOT

/				/A DECIMAL DIGIT WITH THE CHARACTER

/				/IN THE AC.

/		???	???	/RETURN HERE IF 1ST CHARACTER

/				/AFTER A BUNCH OF SPACES IS A DECIMAL

/				/DIGIT WITH THE BREAK CHARACTER IN THE

/				/AC AND THE NUMBER IN THE MQ.

/ 

NUMBER	0

	LAW	-4		/SET DIGIT COUNTER

	DAC	COUNT

	DZM	NUM		/ZERO PREVIOUS RESULTS

	CLC			/SET A FLAG TO INDICATE THAT SPACES

	DAC	NUMFLG		/ARE NOT BREAK CHARACTERS YET.

NUM1	JMS*	(FAC		/GET A CHARACTER

	SAD	(40		/WAS THE CHARACTER A SPACE?

	JMP	NUMSPC		/YES

	DZM	NUMFLG		/NO -- CLEAR FLAG TO INDICATE THAT ANY

				/SPACES ENCOUNTERED SHOULD BE USED AS

				/BREAK CHARACTERS.

	DAC	NUMT		/SAVE IT TEMPORARILY

	AAC	-60		/IS IT A DIGIT?

	SPA

	JMP	NUM2		/NO -- EITHER A BREAK OR AN ERROR

	DAC	CHAR		/SAVE THE POTENTIAL DIGIT

	AAC	-12

	SMA

	JMP	NUM2		/NO -- EITHER A BREAK OR AN ERROR

	LAC	NUM		/YES -- PICK UP THE REAL NUMBER

				/THAT HAS ALREADY BEEN CONSTRUCTED

	CLL

	MUL			/MULTIPLY IT BY 10 DECIMAL

	12

	LACQ			/GET RESULT INTO AC

	TAD	CHAR		/ADD THE DIGIT JUST READ

	DAC	NUM		/SAVE THE RESULTING DECIMAL NUMBER

	ISZ	COUNT		/HAVE 4 DIGITS BEEN READ?

	JMP	NUM1		/NO -- READ SOME MORE

	JMS*	(FAC		/YES -- READ A BREAK CHARACTER

NUM3	DAC	CHAR		/SAVE THE CHARACTER TEMPORARILY

	IDX	NUMBER		/PREPARE TO RETURN AT JMS+2

	LAC	NUM		/PICK UP THE DECIMAL NUMBER

	LMQ			/STORE IT IN THE MQ

	LAC	CHAR		/GET THE BREAK CHAR INTO THE AC

	JMP*	NUMBER		/RETURN AT JMS+2

NUM2	LAW	-4		/CHARACTER IS EITHER A BREAK OR ERROR

	SAD	COUNT		/IF THIS WAS THE 1ST CHARACTER READ

				/ITS AN ERROR. OTHERWIZE ITS A BREAK.

	JMP	NUMERR		/ERROR

	LAC	NUMT		/BREAK -- GET THE CHARACTER INTO AC

	JMP	NUM3

NUMERR	LAC	NUMT		/ERROR SO GET CHARACTER INTO AC

	JMP*	NUMBER		/AND RETURN AT JMS+1

NUMSPC	LAC	NUMFLG		/CHAR. WAS A SPACE -- IS IT A BREAK CHAR.?

	SZA

	JMP	NUM1		/NO -- THE SPACE SHOULD BE IGNORED

	LAC	(40		/YES -- TREAT THE SPACE AS A BREAK CHAR.

	DAC	NUMT

	JMP	NUM2

/

/ MISC ROUTINES AND OTHER STUFF

/

REQMCR	1

	0

	.SIXBT "..."

	.SIXBT "MCR"

	0

/

WRITE	2700

	EV

	3

	2

	XX

/

WAIT	20

	EV

/

UNIT	0

TEMP	0

TTWD0	0

BITS	0

TERM	0

COUNT	0

NUM	0

NUMFLG	0

NUMT	0

CHAR	0

	.DEC

D1200	1200

D2400	2400

DM600	-600
MD300	-300

	.OCT

/

ERR1	LAC	(MSG1

	SKP

ERR2	LAC	(MSG2

	SKP

ERR4	LAC	(MSG4

	DAC	WRITE+4

	CAL	WRITE

	CAL	WAIT

	JMP	EXITCR

/

MSG1	MSG2-MSG1/2*1000

	0

	.ASCII "DTC -- FORMAT ERROR "<15>

MSG2	MSG4-MSG2/2*1000

	0

	.ASCII "DTC -- ILLEGAL UNIT NUMBER"<15>

MSG4	EV-MSG4/2*1000

	0

	.ASCII "DTC -- ILLEGAL BAUD RATE"<15>

EV	0

	.END
