; subs to do mcr checking ; for addition to ECR ; ; F. borger, May 6 86 ; .TITLE MCRSUB ; ; .mcall dir$,spwn$ ; .psect rodata,ro,d,lcl,rel,con ut.ho=10 ;define hostile bit atrad: .rad50 /at./ ;...at. name spwdpb: spwn$ ...hel ;dpb to spawn hello .psect rwdata,rw,d,lcl,rel,con actcnt: .word 0 ;count of tasks active here ; .psect code,ro,i,lcl,rel,con MCRSUB:: mov @#.crtsk,r0 ;get my atl clr actcnt ;clear task counter mov #.atllh,r1 ;get atl listhead mov ps.exp,-(sp) ;disable task switching bis #140,ps.exp 1$: mov (r1),r1 ;go thru atl cmp r1,.atllh+2 ;last entry in atl ? beq 3$ ;br if yes cmp a.ti(r1),a.ti(r0) ;is this task active at my term ? bne 2$ ;no, skip further checks bit #af.ia,a.tf(r1) ;is it a time sharing task ? beq 2$ ;no, skip further checks mov a.td(r1),r5 ;get std of task cmp s.tn+2(r5),atrad ;is it ...at. ? beq 2$ ;yes inc actcnt ;no, count one task 2$: cmp r0,r1 ;is this task me ? beq 1$ ;yes, skip further tests cmp a.td(r0),a.td(r1) ;no, is it another ECR bne 1$ ;br if not cmp a.ti(r0),a.ti(r1) ;yes, is it at same ti ? bne 1$ ;br if not jsr pc,..enb0 ;yes, enable switching again call exit ;and exit 3$: jsr pc,..enb0 ;otherwise, enable switching mov a.ti(r0),r5 ;get ti of task bitb #ut.ho,u.pr(r5) ;is this a hostile terminal beq 4$ ;no, skip other test tst actcnt ;other task active ble 4$ ;br if not call exit ;else exit 4$: bitb #ut.lg,u.pr(r5) ;is terminal logged on ? beq 5$ ;br if not rts pc ;else return 5$: dir$ #spwdpb ;otherwise spawn hel call exit ;and exit .end