.title stspwn ;+ ; integer function stspwn(buf) ; ; this routine spawns the command line found in buf to MCR... and ; waits for it's completion. Either the DSW or the final status ; of the offspring task is returned ; ; r$spwn ; this routine spawns the command line found in r1 to MCR... and ; waits for it. Either the directive status word or the first ; word of the error status block is returned in r0. ;- .mcall spwn$s,stse$s .psect $r.rod,con,ro,rel,lcl,d mcr: .rad50 /MCR.../ .psect $r.roi,con,ro,rel,lcl,i .enabl lsb ap=%5 buf=2 stspwn:: mov buf(ap),r1 ; place buffer address in r1 r$spwn:: mov r2,-(sp) ; save register used mov r1,-(sp) ; save buffer address mov #-1,r0 ; initialize counter 10$: inc r0 ; increment counter tstb (r1)+ ; at end of string yet? bne 10$ ; NO mov (sp)+,r1 ; restore r1 sub #16.,sp ; space for error status block mov sp,r2 ; address of error status block spwn$s #mcr,,,,,r$spef,,r2,r1,r0,#0 ; spawn task bcs 30$ ; c set => error stse$s r$spef ; stop for event flag mov (r2),r0 ; return status br 40$ 30$: mov @#$dsw,r0 ; return directive status word 40$: add #16.,sp ; remove error block from stack mov (sp)+,r2 ; restore r2 return .end