.TITLE CONNECT/DISCONNECT Local Commands .Psect Conect,Con .Mcall $RMT01, $List, $SkipList, $Alvin ;; .GLOBL CONNECT,DCONNECT,CONSTATUS ;INTERNAL GLOBALS .GLOBL CMDMATCH,CMDCANCEL,CRLF,PutList ;EXTERNAL GLOBALS .Globl AlvEnable, AlvDisable, GetDDA .Globl RmtCon, RmtRunit, RmtXunit $RMT01 $Alvin ;;**************************************************************************** ;; Last Modified 5-Dec-85 DVJensen CONNECT will now dynamically enable the ;; receiver and transmitter of the associated remote system. ;; Explicit DISCONNECT will disable the associated devices. ;; A Connect of a second remote system will not explicitly ;; disconnect the previous remote. The Connect of a command ;; table will logically disconnect the current remote but ;; will not disable it. The CONNECT STATUS command will display ;; which remote system is CURRENTLY ACTIVE if one is active. ;; 3-Feb-86 DJ Fixed bug in Disconnect command. ;; 8-May-86 DJ Added CLx support for the new default devices and defined ;; default buffers for each receiver. Expanded the Conn table. ;;**************************************************************************** ;; Local command to logically connect a remote system or command table. ;; If the defined remote system keyword is recognized, the disconnect ;; bit is cleared in the global control word. ;; A message confirmes the connection. ;; Otherwise, a message lists the received connect parameter string ;; and indicates that it is invalid. ;; CONNECT:: Cmp (R3),2(R3) ; Is there a connect parameter? Blos ConMat ; Yes, branch. Mov #ConCMD,R1 ; Connnect implies Connect COMMANDS. Br Conn10 ; Proceed as if CONNECT COMMANDS. ConMat: JSR R5,CMDMATCH ;MATCH 2ND PARAMETER .WORD CONTABLE ;TABLE DEFINING VALID SET .WORD 0 ;ENTER FROM COMMAND MANAGER W/CMDSTR IN R3 BR CONBAD ;MATCH FAIL - ALERT MOV R0,R1 ;GET POINTER TO TABLE ENTRY STRING DESC BEQ DOSTATUS ;IF ZERO, IS REQUEST FOR CONNECT STATUS Conn10: Bis #DisConnect,RmtCon ; Previous remote now disconnected; ; Therefore CONNECT COMMANDS will implicitly DISCONNECT the current remote but ; leave it enabled (allow continued buffering of input stream). Tst 10(R1) ; Is this a local system command table? Bmi ConMsg ; Yes, branch - just list the message. Bit #DisConnect,@6(R1) ; Is it already enabled? Beq Connon ; Yes, branch around the enables. Mov 10(R1),R3 ; Get the remote RECEIVER UNIT NUMBER. Jsr Pc,AlvEna ; Attempt to enable it. Bcs ConCancel ; (Presume AlvEna alerted the user to errors) Jsr R5,GetDDA ; Get Device Descriptor Adr of the receiver. .Word -1 Bcs ConCancel ; (It should be found if it enabled OK.) Tst BDefault(R0) ; Is there a default buffer? Bne Connxe ; Yes, then do not override it. Mov 14(R1),BDefault(R0) ; Put a default buffer into the receiver. Connxe: Mov 12(R1),R3 ; Get the remote TRANSMITTER UNIT NUMBER. Jsr Pc,AlvEna ; Attempt to enable the transmitter. Bcs ConCancel ; Branch if enable failed. Connon: Mov 10(R1),RmtRunit; Select REMOTE RECEIVER for command manager. Mov 12(R1),RmtXunit; Select REMOTE TRANSMITTER for the manager. Bic #DisConnect,RmtCon ; Let the Command Manager know. Bic #DISCONNECT,@6(R1) ; Set CONNECTed status for this remote. ConMsg: Mov R1,R3 ; Get the address of remote system name. JSR R5,PutList ; List the system name. CONFIRM action. .WORD 0 ; (string desc is in reg 3) JSR R5,PutList .WORD CONSTR ;" CONNECTED. " RTS PC ;RETURN TO COMMAND MANAGER ;;**************************** ;; ;; SUB-COMMAND OF CONNECT OR DISCONNECT TO DISPLAY CONNECT STATUS ;; DOSTATUS: JSR PC,CONSTAT ;LIST STATUS RTS PC ;AND RETURN TO COMMAND MANAGER ;;**************************** ;; CONBAD: JSR R5,PutList ;LIST UNMATCHED PARAMETER .WORD 0 ;(Command string desc is in reg 3) JSR R5,PutList .WORD CONINV ;" : INVALID. " ConCan: JSR PC,CMDCANCEL RTS PC ;RETURN TO COMMAND MANAGER ;;**************************** ;; ;; LOCAL COMMAND TO LOGICALLY DISCONNECT A SUBSYSTEM. ;; IF DEFINED SUB-SYSTEM KEYWORD IS RECOGNIZED, THE DISCONNECT ;; BIT IS SET IN THE GLOBAL CONTROL WORD. ;; A MESSAGE CONFIRMS THE DISCONNECTION. ;; ELSE A MESSAGE LISTS THE RECEIVED DISCONNECT PARAMETER STRING ;; AND INDICATES THAT IT IS INVALID. ;; DCONNECT:: Cmp (R3),2(R3) ; Is there a disconnect parameter? Blos DConMat ; Yes, branch. Mov #ConCMD,R1 ; Disconnnect implies Connect COMMANDS. Br Conn10 ; Proceed as if CONNECT COMMANDS. DConMat: JSR R5,CMDMATCH ;TRY TO MATCH 2ND PARAMETER .WORD CONTABLE ;TABLE DEFINING VALID SET .WORD 0 ;ENTER FROM COMMAND MANAGER W/CMDSTR IN R3 BR CONBAD ;MATCH FAIL - ALERT MOV R0,R3 ;GET POINTER TO TABLE ENTRY STRING DESC Mov R0,R1 BEQ DOSTATUS ;IF ZERO, IS REQUEST FOR DISCONNECT STATUS Tst 10(R1) ; Is this actually a remote (check unit #)? Bpl Dcongo ; Yes, branch. $List ,0 ; List the command table ID (desc in R3). $List < cannot be disconnected.> Rts PC Dcongo: BIS #DISCONNECT,@6(R1) ; Set control word bit for DISCONNECT. Cmp 10(R1),RmtRunit; Is this the currently Active remote? Bne DConly ; No, branch to continue to allow REMOTE. Bis #DisConnect,RmtCon ; Tell command manager there is no remote. DConly: $List ,0 ; List remote system ID (desc in R3). $List ,DisStr ; "Disconnected." Mov 10(R1),R3 ; Get the remote receiver's logical unit num. Jsr Pc,AlvDis ; Disable it. Mov 12(R1),R3 ; Get the remote transmitter's logical unit. Jsr Pc,AlvDis ; Disable it. RTS PC ; RETURN to command manager. ;;**************************** ;; ;; GLOBAL SUBROUTINE TO SHOW DEFINED SUBSYSTEMS CONNECTION STATUS ;; CONSTATUS: MOV R5,-(SP) ;SAVE REGISTERS USED MOV R3,-(SP) MOV #CONTABLE,R5 ;GET CONNECT TABLE ADDRESS MOV (R5)+,R3 ;GET BEGINNING ADDRESS OF ENTRIES TST (R3)+ ;INCR TO STRING DESC JSR PC,CRLF ;SKIP A LINE JSR R5,PutList ;LIST CONNECT STATUS HEADER .WORD CONSID CONSLP: JSR PC,CRLF ;GO TO A NEW LINE CMP R3,#CONSTOP ;DONE WITH TABLE? BHIS CONSX ;YES, EXIT JSR R5,PutList ;LIST PROMPT .WORD 0 BIT #DISCONNECT,@6(R3) ;IS THIS ONE DISCONNECTED? BNE DISOUT ;YES, BRANCH JSR R5,PutList ;NO .WORD CONSTR ;LIST " CONNECTED. " Bit #Disconnect,RmtCon ; Is there currently a remote? Bne ConSon ; No, then all done. Cmp RmtRunit,10(R3) ; Find the one that is active. Bne Conson ; Branch if not the current remote. $List < Current Remote. > ; Alert the user, this one is active. BR CONSON DISOUT: JSR R5,PutList .WORD DISSTR ;LIST " DISCONNECTED. " CONSON: ADD 2(R5),R3 ;INCR TO NEXT TABLE ENTRY BR CONSLP ;LOOP UNTIL TABLE EXHAUSTED CONSX: MOV (SP)+,R3 ;RESTORE REGISTERS USED MOV (SP)+,R5 RTS PC ;RETURN TO CALLING PROGRAM ;;********************************************************************* ;; STRING DESCRIPTORS AND CONNECT PARAMETER TABLE ;; DISSTR: .WORD CONS10 ;" DISCONNECTED. " .WORD CONS20 CONSTR: .WORD CONS20 ;" CONNECTED. " .WORD CONS30 CONINV: .WORD CONS60 ;" : INVALID. " .WORD CONS61 CONSID: .WORD CONS69 ;"-- CONNECT STATUS --" .WORD CONS72 ;; ;; STRINGS ;; CONS10: .ASCII ' disconnected.' CONS20: .ASCII ' connected.' CONS30: CONS60: .ASCII ' : Invalid.' CONS61: .ASCII ' ' CONS69: .ASCII '-- CONNECT ' CONS70: .ASCII 'STATUS' CONS71=.-1 .ASCII ' --' CONS72=.-1 .Even ;;**************************************************************************** ;; Connect parameter table: ;; .GLOBL CMDCTL ;Command control word. .GLOBL CL0Ctl, CL1ctl, CL2ctl, CL3ctl ; Connect control words. .Globl CL4ctl, CL5ctl, CL6ctl, CL7ctl ; Connect control words. CONTABLE: .WORD CONBEGIN ;CONNECT/DISCONNECT PARAMETER TABLE .WORD CONEND .WORD 20 ;SIZE OF AN ENTRY ;; CONBEGIN: .WORD 3 ;MIN MATCH LENGTH ConCMD: .WORD CONS40 ;"COMMANDS" .WORD CONS41 .WORD .-4 ;RETURNED VALUE IS ADDRESS OF STRING DESC .WORD CMDCTL ;Command global control word. .Word -1 ; Dummy to flag that this is not a remote system. .Word -1 ; dito .Word 0 ;*; .WORD 3 ; Minimum match length. .WORD CONCL0 ; Remote system attached to "CL0" .WORD CONC0E ; End of string. .WORD .-4 ; Returned value is address of string desc. .WORD CL0Ctl ; Global control word. .Word 2 ; Logical unit number of the receiver. .Word 3 ; Logical unit number of the transmitter. .Word BufCL0 ; A default buffer for input. ;*; .WORD 3 ; Minimum match length. .WORD CONCL1 ; Remote system attached to "CL1" .WORD CONC1E ; End of string. .WORD .-4 ; Returned value is address of string desc. .WORD CL1Ctl ; Global control word. .Word 4 ; Logical unit number of the receiver. .Word 5 ; Logical unit number of the transmitter. .Word BufCL1 ; A default buffer for input. ;*; .WORD 3 ; Minimum match length. .WORD CONCL2 ; Remote system attached to "CL2" .WORD CONC2E ; End of string. .WORD .-4 ; Returned value is address of string desc. .WORD CL2Ctl ; Global control word. .Word 6 ; Logical unit number of the receiver. .Word 7 ; Logical unit number of the transmitter. .Word BufCL2 ; A default buffer for input. ;*; .WORD 3 ; Minimum match length. .WORD CONCL3 ; Remote system attached to "CL3" .WORD CONC3E ; End of string. .WORD .-4 ; Returned value is address of string desc. .WORD CL3Ctl ; Global control word. .Word 8. ; Logical unit number of the receiver. .Word 9. ; Logical unit number of the transmitter. .Word BufCL3 ; A default buffer for input. ;*; .WORD 3 ; Minimum match length. .WORD CONCL4 ; Remote system attached to "CL4" .WORD CONC4E ; End of string. .WORD .-4 ; Returned value is address of string desc. .WORD CL4Ctl ; Global control word. .Word 10. ; Logical unit number of the receiver. .Word 11. ; Logical unit number of the transmitter. .Word BufCL4 ; A default buffer for input. ;*; .WORD 3 ; Minimum match length. .WORD CONCL5 ; Remote system attached to "CL5" .WORD CONC5E ; End of string. .WORD .-4 ; Returned value is address of string desc. .WORD CL5Ctl ; Global control word. .Word 12. ; Logical unit number of the receiver. .Word 13. ; Logical unit number of the transmitter. .Word BufCL5 ; A default buffer for input. ;*; .WORD 3 ; Minimum match length. .WORD CONCL6 ; Remote system attached to "CL6" .WORD CONC6E ; End of string. .WORD .-4 ; Returned value is address of string desc. .WORD CL6Ctl ; Global control word. .Word 14. ; Logical unit number of the receiver. .Word 15. ; Logical unit number of the transmitter. .Word BufCL6 ; A default buffer for input. ;*;*; .WORD 3 ; Minimum match length. .WORD CONCL7 ; Remote system attached to "CL7" .WORD CONC7E ; End of string. .WORD .-4 ; Returned value is address of string desc. .WORD CL7Ctl ; Global control word. .Word 16. ; Logical unit number of the receiver. .Word 17. ; Logical unit number of the transmitter. .Word BufCL7 ; A default buffer for input. ;*; CONSTOP: .WORD 3 ;STATUS MINIMUM MATCH LENGTH .WORD CONS70 ;STRING DESCRIPTOR .WORD CONS71 .WORD 0 ;ZERO IS VALUE RETURNED TO INDICATE STATUS .Word -1 .Word -1 .Word 0 CONEND: .WORD . ;(DUMMY ENTRY) ;;********************************************************************** CONS40: .ASCII 'COMMANDS' CONS41=.-1 CONCL0: .ASCII 'CL0' CONC0E=.-1 CONCL1: .ASCII 'CL1' CONC1E=.-1 CONCL2: .ASCII 'CL2' CONC2E=.-1 CONCL3: .ASCII 'CL3' CONC3E=.-1 CONCL4: .ASCII 'CL4' CONC4E=.-1 CONCL5: .ASCII 'CL5' CONC5E=.-1 CONCL6: .ASCII 'CL6' CONC6E=.-1 CONCL7: .ASCII 'CL7' CONC7E=.-1 .EVEN ;;********************************************************************** .Psect CmdMgr,Con,Gbl CMDCtl:: .Word 0 ; Command table connect control word. CL0Ctl:: .Word Disconnect ; Remote link control word - in the root. CL1Ctl:: .Word Disconnect ; Remote link control word - in the root. CL2Ctl:: .Word Disconnect ; Remote link control word - in the root. CL3Ctl:: .Word Disconnect ; Remote link control word - in the root. CL4Ctl:: .Word Disconnect ; Remote link control word - in the root. CL5Ctl:: .Word Disconnect ; Remote link control word - in the root. CL6Ctl:: .Word Disconnect ; Remote link control word - in the root. CL7Ctl:: .Word Disconnect ; Remote link control word - in the root. ;; BufCL0:: .Word Buf0s ; Buffer descriptor. .Word Buf0s .Word Buf0s .Word Buf0e ;*; BufCL1:: .Word Buf1s ; Buffer descriptor. .Word Buf1s .Word Buf1s .Word Buf1e ;*; BufCL2:: .Word Buf2s ; Buffer descriptor. .Word Buf2s .Word Buf2s .Word Buf2e ;*; BufCL3:: .Word Buf3s ; Buffer descriptor. .Word Buf3s .Word Buf3s .Word Buf3e ;*; BufCL4:: .Word Buf4s ; Buffer descriptor. .Word Buf4s .Word Buf4s .Word Buf4e ;*; BufCL5:: .Word Buf5s ; Buffer descriptor. .Word Buf5s .Word Buf5s .Word Buf5e ;*; BufCL6:: .Word Buf6s ; Buffer descriptor. .Word Buf6s .Word Buf6s .Word Buf6e ;*; BufCL7:: .Word Buf7s ; Buffer descriptor. .Word Buf7s .Word Buf7s .Word Buf7e ;*; Buf0s: .Blkw 32. ; A buffer of 64 bytes. Buf0e=.-1 Buf1s: .Blkw 32. ; A buffer of 64 bytes. Buf1e=.-1 Buf2s: .Blkw 32. ; A buffer of 64 bytes. Buf2e=.-1 Buf3s: .Blkw 32. ; A buffer of 64 bytes. Buf3e=.-1 Buf4s: .Blkw 32. ; A buffer of 64 bytes. Buf4e=.-1 Buf5s: .Blkw 32. ; A buffer of 64 bytes. Buf5e=.-1 Buf6s: .Blkw 32. ; A buffer of 64 bytes. Buf6e=.-1 Buf7s: .Blkw 32. ; A buffer of 64 bytes. Buf7e=.-1 ;;******************************* .END