.title srda .mcall gtsk$s, srda$s, ustp$s, astx$s ap=%5 ; argument pointer new=2 ; offset from ap for new ast address old=4 ; same for old .psect $r.rwd,con,rw,rel,lcl,d task: .word 0,0 ; storage for task name curast: .word 0 .psect $r.roi,con,ro,rel,lcl,i .enabl lsb srda:: tst task ; have we done GTSK yet? bne 10$ ; yes we have sub #32.,sp ; space for GTSK mov sp,r0 ; address of buffer gtsk$s r0 ; get current task name in buf mov (r0)+,task ; copy taskname into local storage mov (r0),task+2 ; ... add #32.,sp ; restore stack 10$: mov @new(ap),r0 ; get new ast address bne 20$ ; if != 0, user specified address mov #cntast,r0 ; user wishes unstop ast 20$: mov curast,@old(ap) ; return old ast address mov r0,curast ; save curent ast address srda$s r0 ; establish new ast return crda:: mov @new(ap),r0 ; get new ast address mov r0,curast ; update current ast address beq 30$ ; if == 0, turn off ast's srda$s r0 ; re-establish old ast address br 40$ 30$: srda$s ; turn off ast's 40$: return cntast: ustp$s #task ; unstop current task astx$s ; dismiss current ast .end