.title fndgrp .inclu "b:global" Text wnod, <"%Felaktig typ av mottaget-nod, avbryter."> .even sect code MBSHIP = 6 ; Membership node ID ;+ Finds a "probably interesting" meeting in MY membership ; list. ; ; Edit history: ; JS 870705 Started ; MH 871121 Completed it. ; ; Parameters: ; None. ; ; Uses: ; FB3 ; TMP+0 Used to indicate if we don't start our search for ; unread texts at the first meting. ; TMP+2 Flag word. ; Bit 1 set: We haven't found meeting # TMP. ; Bit 2 set: We have reached the end-of-list once. ; ; Returns: ; r0 = meeting # if found, else zero. ;- fndgrp: push clr tmp ; Nothing special. clr tmp+2 tst thsgr beq 5$ mov thsgr, tmp bis #1, tmp+2 5$: mov #FB3, r3 gos getme mov 24(r1), r3 ; Memebership count. beq 70$ clr r2 div #20., r2 ; R4 = Used entries in last record mov r3, r4 bne 7$ mov #20., r4 7$: mov #FB3, r3 clr -2(r3) ; Indicate "no block in buffer" mov 26(r1), r2 ; First record in membership list 10$: tst r2 beq 60$ ; while (r2 != NULL) { gos tryrec <#1,r2,r3,#unlock> cmp (r1)+, #MBSHIP ; Right type of node? beq 20$ write #wnod br 70$ 20$: mov #20., r5 ; Assume a full node. mov (r1)+, r2 ; Get pointer to next record in list bne 30$ ; Last node! May not be fully filled. mov r4, r5 beq 60$ 30$: add #4, r1 ; Advance pointer two words. 40$: mov (r1)+, r0 cmp r0, tmp ; This meeting? bne 45$ ; No, 45$ bit #2, tmp+2 ; Yes. Is this the second time? bne 70$ ; Yes, 70$ bic #1, tmp+2 ; We found the meeting! br 50$ ; But, start at the next one. 45$: bit #1, tmp+2 bne 50$ call gethig ; Returns high in R0. cmp r0, (r1) ; Non read entries in this meeting? bhi 100$ ; Yes, Do somethis at 100$ 50$: add #4, r1 sob r5, 40$ ; No. Try next meeting. br 10$ 60$: tst tmp beq 70$ ; No previous meeting. Just quit! bit #2, tmp+2 bne 70$ ; Safety catch! Just quit! bic #1, tmp+2 ; We found the meeting! bis #2, tmp+2 ; Second time trough. jmp 5$ ; Do it again! 70$: clr r0 ; Mark r0 as no meeting found. 80$: pop tst (sp)+ rts pc 100$: gos crtels <-2(r1), (r1), 2(r1)> ; May not destroy FB3 tst r0 bne 80$ ; Don't read those entries. mov -2(r1), r0 call gethig ; Returns high in R0. call MtxBgn gos get <#1, -2(r3), r3, #1, #Lock> mov r0, (r1) ; Update my counter. gos put <#1,,r3> ; Nothing to read anymore. call MtxEnd clr curgrp ; push ; write #allan ; pop br 50$ ; text allan, <"Sparar-2!!!"> .end