; DETACH - detach terminal from job ; ; Copyright [c] Noel Alaska Systems Technology, 1983. VMAJOR = 1. ; version equates VMINOR = 0. VSUB = 0. VEDIT = 2. ; CHANGE EACH EDIT <----------- VWHO = 0. SEARCH SYS ; AMOS librarys SEARCH SYSSYM SEARCH TRM SEARCH MFN ; My library DSECT .=0 ; define impure area TERM: BLKL 1 BUFF: BLKB 8. EVEN IMPURE = . .=0 PSECT BEGIN: PHDR -1,-1,PH$REE!PH$REU GETIMP IMPURE,A4 ; get memory LIN JNE 0$ TYPECR EXIT 0$: FILNAM TERM(A4),XXX ; get terminal name MOV TRMDFC,A5 ; point to TRMDEF chain 1$: CMM TERM(A4),4(A5) ; is this the right one? BEQ 2$ ; YES MOV @A5,D7 ; advance TRMDEF pointer MOV D7,A5 BNE 1$ ; loop thru them all... TYPECR EXIT 2$: ADD #10,A5 ; point to STS (base) LEA A1,TERM(A4) ; print terminal name CALL PRINT MOV T.JLK(A5),D7 ; is terminal attached? MOV D7,A0 BEQ 4$ ; NO CLR T.JLK(A5) ; YES - detach it CLR JOBTRM(A0) TYPE < detached from > LEA A1,JOBNAM(A0) ; print name of job formerly attached CALL PRINT BR 5$ 4$: TYPE < not connected> 5$: CRLF SUPVR SVLOK CALL DRAINO ; purge it's I/O SVUNLK EXIT ; routine to print RAD50 name pointed to by R1 PRINT: LEA A2,BUFF(A4) ; point to buffer UNPACK ; ascii into buffer UNPACK 0$: CMMB -(A2),#40 ; remove trailing spaces BEQ 0$ CLRB 1(A2) ; mark end TTYL BUFF(A4) ; print buffer RTN ; must be entered LOCKed w/A5 --> TRMDEF DRAINO: SAVE A0-A6,D0-D7 BIS #T$OIP,@A5 ; turn on output in progress MOV T.OQX(A5),D7 ; any output queued? MOV D7,A3 BEQ 2$ ; NO ADD #4,A3 ; skip to command word CMP (A3)+,#10 ; is this ^S block? BNE 2$ ; NO BIC #1,@A3 ; reset ^S suspend 2$: TRMOCP ; get output TST D1 ; end yet? BPL 2$ ; NO BIC #T$OIP,@A5 ; YES - reset OIP CLR T.ICC(A5) ; clear input system also... CLR T.ECC(A5) CLR T.BCC(A5) REST A0-A6,D0-D7 RTN EVEN END