/ 
/ 
/                   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) 1974, BY DIGITAL EQUIPMENT CORPORATION
/ 
/ 
        .EJECT
/ EDIT #5
/
/ COPYRIGHT 1971,1972,1973,1974 DIGITAL EQUIP CORP., MAYNARD, MASS.
/
/ TTYIO             8 JAN 74               H. KREJCI
/						M. HEBENSTREIT
/
/ RSX CHECKOUT PACKAGE
/
/ TASK TO REQUEST A TYPEIN ON 'NL' LOGICAL UNITS STARTING
/ LUN 'SL'; READ FROM ALL LUNS; ECHO THE INPUT LINE TEN
/ TIMES; AND EXIT.
/
	.DEC
SL=32	/STARTING LUN
	.IFUND NL
NL=6	/NUMBER OF LUN'S
	.ENDC
BZ=20	/LINE BUFFER SIZE (IN 2.5 CHARS)
	.OCT
/
START	LAC	(SL)	/REQUEST INPUT FROM ALL LUN'S
	DAC	RICPB+2
/ 
	CAL	ATTACH
PRINTA	CAL	PRINT
	CAL	WAIT
	CAL	READ
	CAL	WAIT
	LAC	EV
	SPA
	JMP	PRINTA
	LAC	BUFF+2
	AND	(774000
	CLL
	LRS	13
	DAC	TEMP1
	LAC	BUFF+2
	AND	(003760
	CLL
	LRS	4
	DAC	TEMP2
	LAC	TEMP1
	AAC	-60
	SPA
	JMP	PRINTA
	AAC	-10
	SMA
	JMP	PRINTA
	LAC	TEMP2
	AAC	-60
	SPA
	JMP	ONEDIG
	AAC	-10
	SMA
	SKP
	JMP	TWODIG
ONEDIG	LAC	TEMP1
	AND	(7
	DAC	TEMP0
	CLA
	JMP	FINDIG
TWODIG	LAC	TEMP1
	AND	(7
	CLL
	ALS	3
	DAC	TEMP0
	LAC	TEMP2
	AND	(7
FINDIG	TAD	TEMP0
	AAC	-NL
	SMA!SZA
	JMP	PRINTA
	AAC	+NL
	TCA
	DAC	TEMP0
	DAC	TEMP1
	DAC	TEMP2
	DAC	TEMP3
	CAL	DETACH
	JMP	RI1
WAIT	20
	EV
INMES	EV-INMES/2*1000
	0
	.ASCII "HOW MANY TTY'S DO YOU HAVE?"<175>
EV	0
BUFF	.BLOCK 20
PRINT	2700
	EV
	3
	2
	INMES
READ	2600
	EV
	3
	2
	BUFF
	20
ATTACH	2400
	0
	3
DETACH	2500
	0
	3
/
RI1	CAL	RICPB
	ISZ	RICPB+2
	ISZ	TEMP0
	SKP
	JMP	RI2
	LAC	RICPB+2
	SAD	(SL+NL)
	SKP
	JMP	RI1
/
RI2	LAC	(2600)
	JMS	IOS
/
	LAW	-12	/ECHO INPUT LINE TEN TIMES
	DAC	CNT
ECH	LAC	TEMP3
	DAC	TEMP1
	DAC	TEMP2
	LAC	(2700
	JMS	IOS
	ISZ	CNT
	JMP	ECH
/
	CAL	(10)	/EXIT
/
CNT	XX		/LINE COUNTER
/
RICPB	2700		/REQUEST INPUT CPB
	0
	XX
	2
	MES1
/
MES1	2; 0; .ASCII "PLEASE TYPE A LINE TERMINATED WITH "
	      .ASCII "A CAR RTN, ON EACH TTY"<15>
/
/
/ IOS -- I/O SUBROUTINE -- ENTER WITH FUNCTION CODES (2600 FOR INPUT,
/ 2700 FOR OUTPUT) IN AC.  THE EVENT VARIABLES IN 'EVT' AND THE LINE
/ BUFFERS IN 'LBT' ARE USED.
/
IOS	0
	DAC	IOCPB+0	/SET I/O FUNCTION CODE
	LAC	(EVT)	/SET EVENT VARIABLE ADR
	DAC	IOCPB+1
	LAC	(SL)	/SET LUN
	DAC	IOCPB+2
	LAC	(LBT)	/SET LINE BUFFER ADDRESS
	DAC	IOCPB+4
/
IOS1	CAL	IOCPB	/ISSUE QUEUE I/O DIRECTIVE
	ISZ	TEMP1
	SKP
	JMP	IOS2
	LAC	IOCPB+4	/OUTPUT TO LAST LUN?
	SAD	(NL-1*BZ+LBT)
	JMP	IOS2	/YES -- WAIT FOR ALL I/O REQUESTS TO COMPLETE
	AAC	+BZ	/NO -- SETUP TO OUTPUT TO NEXT LUN
	DAC	IOCPB+4	/ADVANCE LINE BUFFER ADDRESS
	ISZ	IOCPB+2	/INCREMENT LUN
	ISZ	IOCPB+1	/INCREMENT EVENT VAR ADR
	JMP	IOS1	/QUEUE I/O REQUEST
/
IOS2	LAC	(EVT)	/WAIT FOR ALL EVENT VARIABLES TO BE SET
	DAC	WFCPB+1	/AND EXIT 'IOS' SUBROUTINE
/
IOS3	CAL	WFCPB
	ISZ	TEMP2
	SKP
	JMP*	IOS
	ISZ	WFCPB+1
	LAC	WFCPB+1
	SAD	(EVT+NL)
	JMP*	IOS
	JMP	IOS3
/ 
TEMP0	0
TEMP1	0
TEMP2	0
TEMP3	0
/ 
/
IOCPB	XX		/INPUT-OUTPUT CPB
	XX
	XX
	2
	XX
	BZ
/
WFCPB	20		/WAITFOR CPB
	XX
/
EVT	.BLOCK NL	/TABLE OF EVENT VARIABLES
/
LBT	.BLOCK NL*BZ	/TABLE OF LINE BUFFERS
/
	.END	START
