.TITLE AUXSPN - Spawn A Command .IDENT /1.0/ .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: AUXSPN.MAC ; Author: Robin Miller ; Date: July 23, 1985 ; ; Description: ; ; This module contains the routines neccessary to spawn a command ; to the Monitor Console Routine (MCR). ; ; Modification History: ; ;- .ENABL AMA .NLIST BEX .MCALL DIR$, SPWN$S, STSE$S ; Local storage: DEFCLI::.BLKW 2 ; The default CLI name. DCLNAM: .RAD50 %...DCL% ; Spawn command to ...DCL 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 to spawn a command from the table parser. It ; detaches the terminal before spawning and then reattaches the terminal ; afterwards. ; ; Inputs: ; R3 = The remaining string byte count. ; R4 = The string buffer address. ; ; Outputs: ; R3 = The string byte count is set to 0. ; R4 = Points to end of the string buffer. ; ; Registers R0 and R1 are destroyed. ; ; All other registers are preserved. ; ;- SPNCMD::CALL PRESPN ; Write the pre-spawn sequence. ;* CALL SEWRAP ; Reenable automatic wrap-around. DIR$ #DETACH ; Detach the terminal. MOV #FMTBUF,R0 ; Copy command to spawn here. MOV R0,R1 ; Copy the output address. ; Copy the command line buffer. 10$: MOVB (R4)+,(R1)+ ; Copy the command line. SOB R3,10$ ; Loop until done. CLRB (R1) ; Terminate the command line. SUB R0,R1 ; Calculate the byte count. ; Setup the CLI to spawn to. MOV #DEFCLI,R2 ; Set address of default CLI. BIT #S.MCR,KEYSTA ; Spawn this command to MCR ? BEQ 20$ ; If EQ, no. MOV #MCRNAM,R2 ; Yes, spawn command to MCR. 20$: BITB #S.DCL,KEYSTA ; Spawn this command to DCL ? BEQ 30$ ; If EQ, no (use the MCR). MOV #DCLNAM,R2 ; Yes, spawn command to DCL. 30$: CALL SPAWN ; Spawn the command line. DIR$ #ATTACH ; Reattach the terminal. CALL CHKERR ; Check/report any errors. ;* CALL CLWRAP ; Disable automatic wrap-around. JMP AFTSPN ; Write the after spawn sequence. .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. ; R2 = Address of CLI to spawn to. ; ; Outputs: ; C bit clear/set = Success/failure. ; ; All registers are preserved. ; ;- SPAWN:: CALL $SAVAL ; Save all registers. MOV R2,R3 ; Copy the CLI to spawn to. 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. SPWN$S R3,,,,,#SPNEFN,,#SPNEST,R0,R1 ; Spawn the command. CALL CHKDIR ; Check the directive status. BCS 100$ ; If CS, the directive failed. STSE$S #SPNEFN ; Stop for spawned command. 100$: RETURN .END