perm filename SAICHN.FAI[S,AIL] blob
sn#191954 filedate 1975-12-15 generic text, type T, neo UTF8
SEARCH HDRFIL
COMPIL(CHN,<GETCHN,NOTOPN,GETCHAN>,<GOGTAB>,<GETCHN, NOTOPN, GETCHAN>)
GETCHN:
HRLI A,(<PUUO 3,0>) ;PREPARE FOR ERR MESS
TRZE CHNL,777760 ;CHECK FOR VALID CHANNEL NO
JRST NOTVALID ;INVALID CHANNEL NUMBER
SKIPE CDB,@CDBLOC(USER) ;IS CHANNEL OPEN? (CDBLOC SET BY ALLOC)
POPJ P,
NOTOPN:
XCT A ;PRINT ROUTINE NAME
ERR <: CHANNEL OR FILE NOT OPEN>
NOTVALID:
XCT A ;ROUTINE NAME
ERR <: CHANNEL NUMBER INVALID>
HERE (GETCHAN)
MOVE USER,GOGTAB
ADD USER,[XWD A,CHANS] ;MAKE @ WORD
MOVEI A,1 ;START AT CHANNEL 1
CHLUP: SKIPN @USER ;IF CHANNEL IS FREE,
POPJ P, ; RETURN
CAIGE A,17 ;CYCLE TO 0?
AOJA A,CHLUP ;NO, TRY NEXT
MOVEI A,0 ;TRY 0
SKIPE @USER ;FREE?
HRROI A,-1 ;NOPE
POPJ P, ;DONE
ENDCOM(CHN)
END