.TITLE GETCMD - GET THE RSXNET COMMAND .IDENT /3.4/ .ENABL LC ;+ ; ; Free software BY ; Project Software & Development, Inc. ; ; This software is furnished for free and may be used and copied as ; desired. This software or any other copies thereof may be provided ; or otherwise made available to any other person. No title to and ; ownership of the software is hereby transferred or allowed. ; ; The information in this software is subject to change without notice ; and should not be construed as a commitment by PROJECT SOFTWARE ; AND DEVELOPMENT, INC. ; ; PROJECT SOFTWARE assumes no responsibility for the use or reliability ; of this software on any equipment whatsoever. ; ; Project Software & Development, Inc. ; 14 Story St. ; Cambridge, Ma. 02138 ; 617-661-1444 ; ; ; Title: GETCMD ; Author: Gary Larsen ; Date: April 1, 1982 ; ; Description: ; ; This module takes a command from RSXNET, checks to see if it is ; a valid command and then calls the appropriate routine. ; ; Modification History: ; ; Version 3.2 July 21, 1982 by Robin Miller ; Added SPEED command as synonym for BAUD_RATE command. ; Version 3.3 October 28, 1982 by Gary Larsen ; Added support to continue to process mcr commands at local ; terminal until user exits mcr command mode. ; Version 3.4 March 1, 1983 by Gary Larsen ; Added MODEM and HANGUP commands to be able to hangup or ; redial form command mode. ;- .ENABL AMA .NLIST BEX .MCALL ASTX$S, DIR$, QIOW$S ; LOCAL EQUATES CMDSIZ = 11. ; SIZE OF AN ENTRY IN COMMAND TABLE BELL = 7 ; RING THE BELL TAB = 9. ; HORIZONTAL TAB LF = 10. ; LINE FEED CR = 13. ; CARRIAGE RETURN SPACE = 32. ; SPACE ; Macro to generate command table. .MACRO CMDENT,STRING .ASCII /STRING/ .NCHR N,STRING .BLKB CMDSIZ-N .ENDM ; Messages: MIOSB:: .BLKW 2 ; I/O STATUS BLOCK FOR MCR PROMPT COMMQ: .ASCIZ %Rsxnet> % ; RSXNET PROMPT INVCMD: .ASCIZ %*** Invalid command, type "HELP COMMANDS" for help. ***% ASKMCR::.ASCIZ %Yes? % ASKL=.-ASKMCR ALLHLP: .BYTE 0 ; TYPE ALL HELP .EVEN ; ENTRIES FOR THE COMMAND TABLE CMDTBL: CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT CMDENT .BYTE -1 .EVEN ; TABLE OF VALUES FOR CMDEQU: .WORD SPEED ; GO CHANGE THE BAUD RATE .WORD DMPFIL ; DUMP A FILE TO THE REMOTE .WORD SETDEB ; SET DEBUGGING OUTPUT FLAG .WORD EXIT ; EXIT FROM RSXNET .WORD GETFIL ; GET A FILE FROM THE REMOTE .WORD HELPC ; GET HELP ON A COMMAND .WORD HANGER ; HANGUP THE MODEM .WORD INTCHR ; CHANGE THE INTERRUPT CHARACTER .WORD LOGFIL ; OPEN A LOGFILE .WORD NOLOG ; CLOSE THE CURRENT LOGFILE .WORD MODEM ; RETRY IN DIALING THE MODEM .WORD SPNMCR ; PROCESS AN MCR COMMAND .WORD GRPORT ; CHANGE THE REMOTE PORT .WORD SNDFIL ; SEND A FILE TO THE REMOTE .WORD SPEED ; GO CHANGE THE REMOTE SPEED .WORD RSETUP ; REPORT LOCAL RSXNET SETUP .WORD SYSTEM ; CHANGE THE REMOTE SYSTEM TYPE .SBTTL GETCMD - GET THE RSXNET COMMAND ;+ ; ; GETCMD - GET THE RSXNET COMMAND ; ; This routine gets an RSXNET command from the user, validates the command ; and then executes it. This allows the user to change RSXNET parameters ; during the communications session. ; ;- GETCMD:: CALL $SAVAL ; SAVE EM ALL CALL CANCEL ; CANCEL OUTSTANDING I/O DIR$ #RESLOC ; RESET LOCAL CHARACTERISTICS CALL CHKLIO ; CHECK FOR ERRORS 10$: CLR ABOFLG ; INIT THE ABORT FLAG MOV #INCMD,R1 ; STORE THE RESPONSE HERE MOV #COMMQ,R2 ; ADDRESS OF THE PROMPT MOV #ALLHLP,HLPADR ; ADDRESS OF HELP STRING CALL PROMPT ; GET THE PARAMETER TSTB (R1) ; DID USER INPUT ANYTHING ? BEQ 30$ ; IF EQ, NO (RETURN) CLR EXACT ; DO NOT FORCE EXACT MATCH MOV #INCMD,R0 ; ADDRESS OF THE RESPONSE MOV #CMDTBL,R1 ; ADDRESS OF TABLE MOV #CMDSIZ,R2 ; SIZE OF EACH ENTRY IN THE TABLE CALL COMPAR ; IS THE COMMAND VALID ? BCC 20$ ; IF CC, YES MOV #INVCMD,R4 ; NO, TELL THE USER CALL WRITE ; DO IT BR 10$ ; AND TRY AGAIN ; Got a valid command, now go process it. 20$: MOV R5,R3 ; COPY THE TABLE ENTRY ADDRESS CLR R2 ; QUOTIENT FOR DIVIDE SUB #CMDTBL,R3 ; FIND THE DIFFERENCE DIV #CMDSIZ,R2 ; CALCULATE THE OFFSET ASL R2 ; MAKE R2 A WORD INDEX CALL @CMDEQU(R2) ; CALL THE APPROPRIATE ROUTINE BR 10$ ; GO GET THE NEXT COMMAND 30$: DIR$ #SETLOC ; SETUP LOCAL CHARACTISTICS CALL CHKLIO ; CHECK FOR ERRORS RETURN ;+ ; ; Get help on a command. ; ;- HELPC: MOV #INCMD,R0 ; ADDRESS OF INPUT STRING CALL SKIP ; SKIP TO SPACE OR TAB MOV R0,HLPADR ; SET THE HELP ADDRESS CALL GETHLP ; GO TYPE THE HELP RETURN ;+ ; ; NOLOG - Close the current logfile. ; ;- NOLOG: CALL FLUSH ; FLUSH THE LOGFILE BUFFER CALL CLOLOG ; NOW CLOSE THE FILE RETURN ;+ ; ; SPNMCR - Spawn an MCR command line. ; ;- SPNMCR:: MOV #INCMD,R0 ; ADDRESS OF INPUT COMMAND CALL SKIP ; SKIP TO THE MCR COMMAND MOV R0,R1 ; COPY FOR LOOP 10$: TSTB (R1)+ ; FIND END OF STRING BNE 10$ ; IF NE, LOOP DEC R1 ; POINT TO THE NULL SUB R0,R1 ; CALCULATE THE BYTE COUNT BEQ 20$ ; IF EQ, NO COMMAND CALL SPAWN ; ELSE SPAWN THE COMMAND BR 30$ ; AND EXIT 20$: QIOW$S #IO.RPR,#LOCAL,#LOCAL,,#MIOSB,,<#INCMD,#80.,,#ASKMCR,#ASKL,#44> TST ABOFLG ; CTRL/C TYPED ? BMI 30$ ; IF MI, YES CMPB MIOSB,#IE.EOF ; CTRL/Z TYPED ? BEQ 30$ ; IF EQ, YES CMP MIOSB,#IS.ESC ; ESCAPE FOR EXIT BEQ 30$ ; IF EQ, YES TST MIOSB+2 ; IS THERE ANYTHING IN THE COMMAND BEQ 20$ ; IF EQ, NO MOV MIOSB+2,R1 ; BYTE COUNT FOR COMMAND MOV #INCMD,R0 ; ADDRESS OF COMMAND TO SPAWN CALL SPAWN ; AND DO IT BR 20$ ; NOW GET THE NEXT COMMAND 30$: RETURN ;+ ; ; SETDEB - Set the debug flag. ; ;- SETDEB: MOV #-1,DEBFLG ; ENABLE DEBUGGING OUTPUT RETURN ;+ ; ; SKIP - Skip to either a space or a tab. ; ; Inputs: ; R0 = address of string to check. ; ; Outputs: ; R0 updated to point past spaces and/or tabs. ; ;- SKIP:: TSTB (R0) ; END OF STRING ? BEQ 20$ ; IF EQ, YES CMPB (R0),#SPACE ; FIND SPACE DELIMITER ? BEQ 10$ ; IF EQ, YES CMPB (R0)+,#TAB ; FIND TAB DELIMITER ? BNE SKIP ; IF NE, NO ; Now skip past all spaces and/or tabs. 10$: CMPB (R0)+,#SPACE ; ANOTHER SPACE ? BEQ 10$ ; IF EQ, YES CMPB -1(R0),#TAB ; WAS LAST BYTE A TAB ? BEQ 10$ ; IF EQ, YES DEC R0 ; POINT TO AFTER SPACE/TAB 20$: RETURN .END