Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50212/open.mac
There is 1 other file named open.mac in the archive. Click here to see a list.
	TITLE OPEN
;ESTABLISHES CONNECTION BETWEEN SEQUENCES OF PACKS
;AND I/O CHANNELS. IT IS CALLED UPON THE FIRST ENTRY INTO DIO.
;CHANNELS ARE ASSIGNED FROM HIGH TO LOW TO(HOPEFULLY) AVOID
;FORSE ASSIGNMENTS. PACK NAMES ARE ENTERED FROM TTY UPON THE
;FIRST ENTRY. IN THE FUTURE PACK NAMES MAY BE OPTIONALLY 
;STORED IN COMMON .
	ENTRY OPEN, PAKFND
	EXTERN FLAG, BUF, MAX, NO.CHN
	OPDEF TTCALL [51B8]
	DEFINE TTYOUT (ADR) <TTCALL 3, ADR>
	DATCHN=5
	DEFINE SETCHN (%A)
	<DPB DATCHN, [POINT 4, %A, 12]
%A:	>
OPEN:	0
	SETOM FLAG
BEGIN:	SKIPE FNDFLG#
	JRST .+4
	TTYOUT CRLF
	TTYOUT [ASCIZ"PACKS:  "]
	TTCALL 11,
	MOVE 6, MAX
	CLEARM NO.CHN
	MOVEI DATCHN, 20
	CLEARM CRF#
NEXT:	SOJ DATCHN,
	MOVEI 1
	ADDM NO.CHN
	CLEARM UFD
	CLEARM COLF#
	MOVE 2, [POINT 6, UFD-1, 35]
	MOVEI 3, 6
TTYIN:	SOJL 3, LENGTH
	TTCALL 4, 1
	CAIN 1, " "
	JRST .-2
	CAIN 1, 015
	JRST CART
	CAIN 1, ","
	JRST COMMA
	CAIN 1, ":"
	JRST COLON
	SUBI 1, 40
	IDPB 1, 2
	JRST TTYIN
COLON:	SKIPE COLF
	JRST SYNTAX
	SETOM COLF
	MOVE UFD
	MOVEM DEVICE
	CLEARM UFD
	JRST TTYIN - 2
CART:	SETOM CRF
COMMA:	SOJL 6, MAXMES
	SETCHN
	INIT 17
DEVICE:	SIXBIT/DSK/
	0
	JRST NOTAVL
	CLEARM UFD+3
	SETCHN
	LOOKUP UFD
	JRST	NOPACK
	CLEARM UFD+3
	SETCHN
	RENAME UFD
	JRST	NOPACK
	CLEARM UFD+3
	SETCHN
	LOOKUP UFD
	JRST	NOPACK
	CLEARM UFD+3
	SETCHN
	ENTER UFD
	0
	MOVEI 1, 17
	SUB 1, DATCHN
	IMULI 1, 200
	ADDI 1, BUF - 1
	HRRM 1, LIST
	SETCHN
	USETI 1
	SETCHN
	IN LIST
	JRST .+4
	TTYOUT CRLF
	TTYOUT [ASCIZ"TRANSMISSION ERROR IN OPEN."]
	CALLI 12
	SKIPN CRF
	JRST	NEXT			;GO BACK FOR NEXT PACK
	TTCALL	11,			;EMPTY THE INPUT BUFFER
	TTYOUT CRLF
	JRA 16,(16)
SYNTAX:	TTYOUT [ASCIZ"SYNTAX ERROR."]
	JSR RESTOR
	TTYOUT CRLF
	JRST BEGIN
NOTAVL:	MOVE 1, DEVICE
	TTYOUT [ASCIZ"DEVICE "]
	JSR TYPE
	TTYOUT [ASCIZ" NOT AVAILABLE."]
	CALLI 12
NOPACK:	MOVE 1, UFD
	TTYOUT [ASCIZ"CAN'T FIND "]
	JSR TYPE
	JSR RESTOR
	TTYOUT CRLF
	JRST BEGIN
TYPE:	0
	MOVE 2, [POINT 6, 0, 35]
	ILDB 3, 2
	JUMPE 3, @TYPE
	ADDI 3, 40
	TTCALL 1, 3
	JRST .-4
MAXMES:	TTYOUT [ASCIZ"NO MORE THAN "]
	MOVEI 60
	ADD MAX
	TTCALL 1,
	TTYOUT [ASCIZ" PACKS ALLOWED."]
	CALLI 12
LENGTH:	TTYOUT [ASCIZ"DEVICE OR PACK NAME TOO LONG."]
	JSR RESTOR
	TTYOUT CRLF
	JRST BEGIN
RESTOR:	0
	CLEARM FNDFLG
	MOVE SAVE
	MOVEM TTYIN+1
	JRST @RESTOR
SAVE:	TTCALL 4, 1
CRLF:	BYTE(7) 015, 012
UFD:	EXP 0, SIXBIT/PAK/, 0, 0
LIST:	IOWD 200,
	0
ACSAVE:	BLOCK 17
PAKFND:	0
	MOVSI 1
	HRRI ACSAVE
	BLT ACSAVE+16
	MOVE 1, @(16)
	CLEAR 2,
	ILDB [POINT 7, 0, 34]
	SUBI 40
	JUMPE .+3
	IDPB [POINT 6, FND-1, 35]
	JRST .-4
	INIT 17, 17
	SIXBIT/DSK/
	0
	JRST NODSK
	LOOKUP 17, FND
	JRST ACPUT
	USETI 17, 1
	IN 17, FLIST
	JRST .+4
	TTYOUT CRLF
	TTYOUT [ASCIZ"TRANSMISSION ERROR IN PAKFND."]
	CALLI 12
	MOVE [ILDB 1, [POINT 7, FNDBUF-1, 34]]
	MOVEM TTYIN+1
	SETOM FNDFLG
ACPUT:	MOVSI ACSAVE
	HRRI 1
	BLT 17
	JRA 16, 1(16)
NODSK:	TTYOUT [ASCIZ"DSK NOT AVAILABLE."]
	CALLI 12
FND:	EXP 0, SIXBIT/FND/, 0, 0
FLIST:	IOWD 20, FNDBUF
	0
FNDBUF:	BLOCK 20
	END