.TITLE MCRCMD .IDENT /V1.01/ .NLIST TOC,SYM .ENABL LC ;+ ; COPYRIGHT (C) 1981, Sira Institute Ltd., ; South Hill, Chislehurst, Kent, BR7 5EH, England. ; ; Author: C J Doran, Date: 30-Nov-81 ; ; Simplified version of SPAWN system subroutine used when a command is to be ; sent to MCR... as from TI: (which is about the only thing it is sensible to ; do on a multi-user system!). Call as: ; ; CALL MCRCMD(command{,iexstat}) ; or I=MCRCMD(command) ; ; Where command is a string in the usual .ASCIZ format, and iexstat (or ; the return value from the function) will be the exit status of the ; spawned task, or a $DSW error code if the spawn itself fails. In either ; case, a return value of 1 should mean success. ; As a special case: -1 means that the function call was silly -- parent/ ; offspring tasking is not supported, or no valid arguments were given. ; ; Assemble as: >MAC SPAWN=LB:[200,200]RSXMC/PA:1,SY:[g,m]SPAWN ; ; where RSXMC.MAC is used for definitions of: ; P$$OFF=1 ; PARENT-OFFSPRING TASKING SUPPORTED and ; S$$TOP=1 ; STOP DIRECTIVE SUPPORT ;- .IF NDF P$$OFF .ERROR ; PARENT-OFFSPRING TASKING REQUIRED .PRINT ; DUMMY ROUTINE IS BEING GENERATED .IFF .PSECT $IDATA,D,RW,LCL,CON MOFLAG=32. ; Borrow error LUN's event flag .MCALL SPWN$,DIR$,WTSE$S,STSE$S SPWMCR: SPWN$ MCR...,,,,,MOFLAG ; Fill in rest later .PSECT $CODE1,I,RW,LCL,CON .IFTF MCRCMD::MOV #177777,%0 ; Default return value to -1 CLR %4 ; Clear argument count BISB @%5,%4 ; Fetch count BEQ EXIT ; Exit if no arguments TST (%5)+ ; Point to command string MOV (%5)+,%1 ; Fetch address .IFF ; That's about all we do if NDF P$$OFF CMP %1,%0 ; Null argument? BEQ RETURN ; Yes, just return "iexstat", if any MOV %1,SPWMCR+S.PWCA ; Have a string, load DPB 10$: TSTB (%1)+ ; Look for null BNE 10$ SUB SPWMCR+S.PWCA,%1 ; To find length DEC %1 MOV %1,SPWMCR+S.PWCL ; Store length SUB #16.,SP ; Make some space for exit status block MOV SP,SPWMCR+S.PWES ; Store address DIR$ #SPWMCR ; Send command to MCR MOV $DSW,%0 ; Return $DSW if it fails BCS 20$ ; and exit without waiting .IIF DF S$$TOP, STSE$S #MOFLAG ; Else stop for spawn .IIF NDF S$$TOP, WTSE$S #MOFLAG ; Else wait for spawn MOV @SP,%0 ; Return task exit status 20$: ADD #16.,SP ; Purge stack .IFTF RETURN: DEC %4 ; Do we have an IEXSTAT argument? BLE EXIT ; No, return immediately MOV @%5,%1 ; Yes, fetch its address CMP %1,#177777 ; Make sure it's a real address BEQ EXIT ; Ignore a blank argument MOV %0,@%1 ; Else store argument EXIT: RTS PC ; Return to caller .ENDC .END