.TITLE VTLSPN - Spawn A Command .IDENT /1.1/ .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: VTLSPN.MAC ; Author: Robin Miller ; Date: March 6, 1985 ; ; Description: ; ; This module contains the routines neccessary to spawn a command ; to the Monitor Console Routine (MCR). ; ; Modification History: ; ; April 2, 1985 by Robin Miller. Edit (01), Version 1.1 ; If VMS native mode routine is disabled, use normal RSX spawn to ; spawn the command to DCL. ; ;- .ENABL AMA .NLIST BEX .MCALL DIR$, SPWN$S, STSE$S ; Local storage: DCLNAM: .RAD50 %...DCL% ; Spawn command to ...DCL (01) MCRNAM: .RAD50 %MCR...% ; Spawn command to MCR... SPNEST::.BLKW 8. ; Spawn exit status block . .SBTTL SPNCMD - Spawn A Command. ;+ ; ; SPNCMD - Spawn a command. ; ; This routine is called from the table parser to spawn a command. The ; table parser takes care of SPAWN without a command line and also strips ; leading spaces and/or tabs. ; ; Format: ; SPAWN command_string ! Spawn specified command. ; ; Inputs: ; R3 = The remaining string byte count. ; R4 = The string buffer address. ; ; Outputs: ; Registers R0 and R1 are destroyed. ; ; All other registers are preserved. ; ;- SPNCMD::CALL WRTEOF ; Write the end of file sequence. DIR$ #DETACH ; Detach the terminal. MOV #FMTBUF,R0 ; Copy command to spawn here. MOV R0,R1 ; Copy the output address. ; Copy the command to spawn. Replace $F with the file name. 10$: CMPB (R4),#'$ ; Is this possibly a "$F" ? BNE 30$ ; If NE, no. CMPB 1(R4),#'F ; Is this really a "$F" ? BNE 30$ ; If NE, no. ADD #2,R4 ; Yes, point past the "$F". DEC R3 ; Adjust for 1 (SOB does other). MOV IENTRY,R2 ; Copy the file entry address. MOV O.FNAM(R2),R2 ; Set address of the file name. ; Append the file name to the command line. 20$: MOVB (R2)+,(R1)+ ; Copy the ASCII file name. BNE 20$ ; If NE, more to copy. DEC R1 ; Point at the null byte. BR 40$ ; Use common code ... ; Copy the next command line character. 30$: MOVB (R4)+,(R1)+ ; Copy the command line. 40$: SOB R3,10$ ; Loop until done. CLRB (R1) ; Terminate the command line. SUB R0,R1 ; Calculate the byte count. CALL SPAWN ; Spawn the command line. DIR$ #ATTACH ; Reattach the terminal. CALL CHKERR ; Check/report any errors. TST VAXFLG ; Running on VAX/VMS system ? BNE 50$ ; If NE, yes. CALL CPYBLA ; Display blank line on RSX-11M. CALL VTYPE ; Display it at the terminal. 50$: CALL PRSPEC ; Prompt the user for a response. JMP REFCMD ; Refresh the terminal screen. .SBTTL SPAWN - Spawn an MCR command line. ;+ ; ; SPAWN - Spawn a MCR command line and wait until it's done. ; ; This subroutine spawns a command to the MCR dispatcher. ; ; Inputs: ; R0 = Command line to spawn ( appended automatically). ; R1 = The command line byte count. ; ; Outputs: ; C bit clear/set = Success/failure. ; ; All registers are preserved. ; ;- SPAWN:: CALL $SAVAL ; Save all registers. MOV #MCRNAM,R3 ; Presume spawn to the MCR. (01) .IFNDF RSX11M TST VAXFLG ; Are we running on VAX/VMS ? BEQ 10$ ; If EQ, no (use normal open). MOV #DCLNAM,R3 ; Set to spawn to DCL CLI. (01) BIT #B.NATV,SWMASK ; Native mode routine disabled ?(01) BEQ 20$ ; If EQ, yes (use RSX11M spawn).(01) CALL VMSPWN ; Spawn a command line on VMS. ;*** BCC 100$ ; If CC, spawn was successful. (01) BR 100$ ; Return with the C-bit status. (01) .ENDC ; RSX11M 10$: MOV R0,R2 ; Copy the buffer address. ADD R1,R2 ; Point to the last byte. MOVB #ESC,(R2)+ ; Append an escape as terminator. ; to prevent an MCR prompt. INC R1 ; Adjust the byte count. 20$: SPWN$S R3,,,,,#SPNEFN,,#SPNEST,R0,R1 ; Spawn the command. (01) CALL CHKDIR ; Check the directive status. BCS 100$ ; If CS, the directive failed. STSE$S #SPNEFN ; Stop for spawned command. 100$: RETURN .END