; This routine is called to create and send a letter to a specified ; person or meeting. ; Call: ; All recivers are to be in DstBuf ; R1 is word 14 (STATUS) of the letter. ; ; If bit 1 is set in R1, it indicates that this is a comment ; and R0 then contains to which letter. ; ; Filebuffers 1-4 and tmp+10, tmp+16 are destroyed. ; .inclu "B:GLOBAL" sect code proc oCrLet var stw, word var ctt, word begin mov r1, stw(r5) ; Word 14 (Status) clr ctt(r5) bit #xKom, r1 ; Komment to ? beq 20$ ; NO! mov r0, ctt(r5) mov #FB4, r1 call gethdr ; Move headerline into tmpstr. br 30$ 20$: movb #377, tmpstr 30$: call compos tst r0 beq 1000$ 50$: gos oSndIt 1000$: ret proc oSndIt, var Count, word ; Counter var To, word ; Temporary Receiver var Net, word var NrRc, word begin mov #DstBuf, r4 mov (r4)+, NrRc(r5) bne 10$ jmp 999$ 10$: write #sento1 ; Send to main receiver. 30$: mov (r4)+, To(r5) ; Receiver mov r4, r0 add (r4)+, r0 ; Pointer to next. mov r4, Net(r5) ; Ponter to headers mov r0, r4 ; Next reciver mov Blk(r5), r0 mov Pos(r5), r1 gos oMkLt, mov tmp+16, Prev(r5) ; Previous in MultR-chain. tst Suc(r5) bne 50$ mov Prev(r5), Suc(r5) mov r0, OrgTxt+2 ; Save Text-Number (long) mov r1, OrgTxt 50$: mov #FB1+2, r3 mov r0, (r3) mov r1, -(r3) mov r3, r1 clr r0 call deco32 gos oItLnk, write #sento2 mov to(r5), r0 call prtnam 60$: dec NrRc(r5) beq 80$ Write #sento4 br 30$ 80$: cmp Suc(r5), Prev(r5) ; More than one Receiver? beq 200$ call MtxBgn push Prev(r5) ; Last Record 90$: gos GetRec, <#2, Prev(r5), #FB1,> ; Yes, link MultiR. 100$: bis #xMulR, 14(r1) ; Got a multireceivet-link. mov Suc(r5), 34(r1) mov Prev(r5), Suc(r5) mov 36(r1), Prev(r5) beq 110$ gos PutGet, <#2, Prev(r5), #FB1> br 100$ 110$: mov (sp)+, 36(r1) gos put, <#2,, #FB1> call MtxEnd 200$: Write #sento3 999$: ret proc oItLnk, var rec, word begin push push MaxLin mov to(r5), r2 call putlet ; Interlink! pop MaxLin bit #xkom, stw(r5) ; Comment? beq 250$ ; No, skip it. call MtxBgn mov ctt(r5), r4 ; Physical record # of comment gos getrec, <#2, r4, #FB4,> tst 32(r1) bne 230$ mov tmp+16, 32(r1) ; tmp+16 is current record gos put, <#2,,#FB4> br 240$ 230$: mov 32(r1), rec(r5) gos tryrec, <#2, 32(r1), #FB4,> mov 30(r1), ctt(r5) mov tmp+16, 30(r1) tst ctt(r5) bne 233$ mov rec(r5), ctt(r5) br 235$ 233$: gos putget <#2, ctt(r5), #FB4> 235$: mov tmp+16, 26(r1) gos putget <#2, tmp+16, #FB4> mov ctt(r5), 30(r1) gos put <#2,,#FB4> 240$: call MtxEnd 250$: pop ret ;+ MakLet makes a letter. It creates nodes in file 2 and 5. ; Data passed: r0, Block number of text in file 3. ; r1, Offset in block. ; Data returned: r0,r1 Long text. ;- Proc oMkLt Var blk, word Var pos, word begin push clr blk(r5) clr pos(r5) mov net(r5), r1 beq 40$ ; No Internetnod! tst (r1) beq 40$ push call PutTxt ; Creat an External-Text-nod mov r0, Blk(r5) ; pointed out by r1 mov r1, Pos(r5) bis #xEXT, stw(r5) ; Mark external bic #xEXIN, stw(r5) ; It's from, not to KOM! pop br 50$ 40$: bic #xEXT!xEXIN, stw(r5) 50$: pop ; Restore block/offset gos oMkLt2 ; Now: r1, r0 = long text # ret proc oMkLt2 Var count, word Var PrsRec, word Var usrec, word Var nrdisp, word begin push call MtxBgn call ccoff gos get <#1, #2, #FB2, #1,> mov #1, r0 call ExLock clr UsRec(r5) ; No found record (yet). clr nrdisp(r5) ; No records to be disposed (yet). clr FB1-2 mov o16(r5), r0 mov #GrpLst, r1 call findCm tst r0 bne 4$ jmp 100$ 4$: mov rArg-rStr(r0), PrsRec(r5) gos GetRec, <#1, PrsRec(r5), #FB4,> mov r1, r3 5$: add #152, r1 tst (r1)+ ; Maximum # of active texts. beq 10$ ; Unlimited if zero! cmp -2(r1), (r1) blos 20$ ; Remove an old text... 10$: inc (r1) gos put, <#1,, #FB4> br 40$ 20$: tst (r1)+ mov (r1), r2 gos GetRec, <#1, 32(r3), #FB3, #Unlock> mov 2(r1), r4 ; Next MOTTAGET. mov r2, r0 asl r0 asl r0 add #12, r0 ; Not 10, r1 points at 2'nd word. add r0, r1 mov (r1), r0 mov -(r1), r1 call rtob5 cmp FB1-2, r0 ; Is record all ready in memory? beq 25$ gos get, <#5, r0, #FB1, #1,> 25$: mov FB1(r1), UsRec(r5) ; Found record (or zero). clr FB1(r1) ; Remove reference. inc r2 cmp #30., r2 ; Is Last text in MOTTAGET removed. bhi 30$ ; No => Goto 30$. mov r4, 32(r3) ; This is from now on 1'st nod! clr r2 gos TryRec, <#1, r4, #FB3, > mov 4(r1), -(sp) ; Nod to be removed (Later). inc nrdisp(r5) ; Nr of records to be disposed. clr 4(r1) ; From now on: No preavious nod. gos put, <#1,,#FB3> 30$: mov r2, 156(r3) ; Index in MOTTAGET. inc 150(r3) ; One more text removed... tst UsRec(r5) bne 35$ mov r3, r1 add #154, r1 br 20$ 35$: gos GetRec, <#1, PrsRec(r5), #FB3,> ; Get a fresh block! mov 150(r3), 150(r1) mov 156(r3), 156(r1) mov 32(r3), 32(r1) gos put, <#1,, #FB3> 40$: mov nrdisp(r5), r2 beq 60$ 50$: mov (sp)+, r0 gos Dispos, <#1, r0, #FB3> ; Remove old MOTTAGET-nodes. sob r2, 50$ 60$: tst UsRec(r5) bne 180$ ; No nodes from receiving group. 100$: mov #FB2, r4 cmp 26(r4), 14(r4) ; Any free nodes to use? bhis 110$ ; No! Remove an old one. jmp 220$ ; Yes! Use a new one. 110$: add #22, r4 clr FB3-2 cmp 14(r4), (r4) bne 120$ cmp 16(r4), 2(r4) bne 120$ jmp 210$ ; Humpffff!!!! 120$: add #1, 14(r4) adc 16(r4) 130$: mov 14(r4), r1 mov 16(r4), r0 call rtob5 140$: mov #FB1, r3 gos get, <#5, r0, r3, #1,> mov #1000, count(r5) sub r1, count(r5) asr count(r5) add r1, r3 150$: mov (r3)+, r2 bne 190$ 160$: cmp 14(r4), (r4) bne 170$ cmp 16(r4), 2(r4) bne 170$ jmp 210$ ; Humpffff 170$: add #1, 14(r4) adc 16(r4) dec count(r5) bgt 150$ br 130$ 180$: mov UsRec(r5), r2 gos GetRec, <#2, r2, #FB3,> mov #FB2+22, r4 ; Compability pointer! br 200$ 190$: cmp o24(r5), r2 ; Pleas don't remove the beq 160$ ; commented text! gos TryRec, <#2, r2, #FB3,> bit #10, 14(r1) ; Important text? bne 160$ ; Yes, don't remov it.. ; tst 32(r1) ; Don't remove a commented text. ; bne 160$ push r1 mov 16(r1), r0 mov #GrpLst, r1 call FindCm tst r0 beq 195$ gos GetRec, <#1, rArg-rStr(r0), #FB4,> dec 154(r1) ; Decreas # of active texts. gos put, <#1,, #FB4> 195$: pop r1 clr -(r3) ; Remove refernces to this text. 200$: mov r2,r0 mov #-1, tmp ; Don`t erase in fil 3. call DELTXT ; Delete an old text to be used. gos Put, <#5,,#FB1> gos GetRec, <#2, r2, #FB3,> inc 20(r4) add #1, (r4) ; Logical letternumber. adc 2(r4) mov r2,(r1) br 240$ 210$: mov #5,r0 call Releas mov #2,r0 call Releas br 230$ 220$: add #22, r4 230$: inc 4(r4) add #1, (r4) ; Logical letternumber. adc 2(r4) mov #2, r0 mov #FB3, r1 call spawn 240$: gos fyslin, <(R1), R4, #FB4> mov (r1), tmp+16 ; Save record number. mov (r1), oldl ; Last READ/WRITTEN letter mov #1, (r1)+ ; Object typ = 1 (TEXT) mov (r4)+, (r1)+ ; Letternumber mov (r4), (r1)+ mov -(r4), tmp+2 ; Save letternumber for later use ... mov 2(r4), tmp+4 .date mov xrb, (r1)+ ; Date or block. mov xrb+2, (r1)+ ; Time or position. mov o12(r5), (r1)+ ; from.... mov o14(r5), (r1)+ ; Status mov o16(r5), (r1)+ ; Receiver mov o20(r5), (r1)+ ; Position (BLOCK) in file 3 mov o22(r5), (r1)+ ; (BYTE) mov o24(r5), (r1)+ ; comment to what (saved above). clr (r1)+ ; Next comment. clr (r1)+ ; Prev. comment. clr (r1)+ ; Comment to this text clr (r1)+ ; Next MultiReceiver. mov o36(r5), (r1)+ ; Previous. mov o40(r5), (r1)+ ; Pointer to EXTERN block. mov o42(r5), (r1)+ ; Position. clr (r1)+ ; Recieved date & time clr (r1)+ gos put <#2,,#FB3> mov #LibInf, r1 call GetAdr add #1, 2(r1) adc 4(r1) ; Highest text # inc 10(r1) ; Edit # for texts gos put <#1,,#FB2> mov #1, r0 mov #2, r1 call UnlBlk ; Releas INFO. mov (r4)+, r1 mov (r4), r0 ; Letternumber! call MtxEnd call ccon pop ret .rem % ;+ MakLet makes a letter. It creates nodes in file 2 and 5. ; Data passed: r0, Block number of text in file 3. ; r1, Offset in block. ; Data returned: r0,r1 Long text. ;- Proc MakLet Var blk, word Var pos, word Var txtnod, long begin push call ccoff .date mov xrb, blk(r5) mov xrb+2, pos(r5) mov net(r5), r0 beq 6$ ; No Internetnod! mov (r0)+, r3 ; Nr of receivers. mov #FB1, r1 mov r3, (r1) ; Nr Of Lines inc (r1)+ ; One status line extra. movb #7, (r1)+ ; Length of that line. clrb (r1)+ ; ** Reserved ** mov blk(r5), (r1)+ ; Date mov pos(r5), (r1)+ ; Time (or reverse)? clr (r1)+ ; ** Reversed ** 2$: clr r2 bisb (r0)+, r2 movb r2, (r1)+ ; Length of line. 4$: movb (r0)+, (r1)+ sob r2, 4$ sob r3, 2$ mov #FB1, r1 call PutTxt mov r0, Blk(r5) mov r1, Pos(r5) bis #xEXT, statw(r5) ; Mark external br 7$ 6$: bic #xEXT!xEXIN, statw(r5) 7$: mov #FB2, r4 gos get <#1, #2, r4, #1,> mov to(r5), r0 call GeTxNo bcc 47$ ; Ther is an old nod to use! cmp 26(r4), 14(r4) ; Any free nodes to use? bhis 9$ ; No! Remove an old one. jmp 60$ ; Yes! Use a new one. 9$: add #22,r4 clr FB3-2 cmp 14(r4),(r4) bne 10$ cmp 16(r4),2(r4) beq 55$ ; Humpffff!!!! 10$: add #1,14(r4) adc 16(r4) 15$: mov 14(r4),r1 mov 16(r4),r0 call rtob5 20$: mov #FB1,r3 gos get, <#5, r0, r3, #1,> mov #1000,tmp+16 sub r1,tmp+16 asr tmp+16 add r1,r3 30$: mov (r3)+,r2 bne 50$ 40$: cmp 14(r4),(r4) bne 45$ cmp 16(r4),2(r4) beq 55$ ; Humpffff 45$: add #1,14(r4) adc 16(r4) dec tmp+16 bgt 30$ br 15$ 47$: call rtob5 mov #FB1,r3 gos get, <#5, r0, r3, #1,> add r1, r3 mov (r3)+, r2 gos GetRec, <#2, r2, #FB3,> tst (r1)+ clr r0 call deco32 call pcrlf iot br 52$ 50$: cmp Commto(r5),r2 beq 40$ gos TryRec, <#2, r2, #FB3,> bit #10,14(r1) bne 40$ tst 32(r1) bne 40$ 52$: mov r2,r0 mov #-1, tmp ; Don`t erase in fil 3. call DELTXT ; Delete an old text to be used. clr -(r3) gos Put, <#5,,#FB1> gos GetRec, <#2, r2, #FB3,> inc 20(r4) add #1, (r4) ; Logical letternumber. adc 2(r4) mov r2,(r1) br 70$ 55$: mov #5,r0 call Releas mov #2,r0 call Releas br 65$ 60$: add #22, r4 65$: inc 4(r4) add #1, (r4) ; Logical letternumber. adc 2(r4) mov #2, r0 mov #FB3, r1 call spawn 70$: gos fyslin, <(R1), R4, #FB4> mov (r1), tmp+16 ; Save record number. mov (r1), oldl ; Last READ/WRITTEN letter mov #1, (r1)+ ; Object typ = 1 (TEXT) mov (r4)+, (r1)+ ; Letternumber mov (r4), (r1)+ mov -(r4), tmp+2 ; Save letternumber for later use ... mov 2(r4), tmp+4 mov Blk(r5), (r1)+ ; Date or block. mov Pos(r5), (r1)+ ; Time or position. mov from(r5), (r1)+ ; from.... mov statw(r5), (r1)+ ; Status mov To(r5), (r1)+ mov (sp)+, (r1)+ ; Position (BLOCK) in file 3 mov (sp)+, (r1)+ ; (BYTE) mov commto(r5), (r1)+ ; comment to what (saved above). clr (r1)+ ; Next comment. clr (r1)+ ; Prev. comment. clr (r1)+ ; Comment to this text clr (r1)+ clr (r1)+ gos put <#2,,#FB3> mov #LibInf, r1 call GetAdr add #1, 2(r1) adc 4(r1) ; Highest text # inc 10(r1) ; Edit # for texts gos put <#1,,#FB2> ; mov r4, r0 ; call SavLet ; Save this. mov (r4)+, r1 mov (r4), r0 ; Letternumber! ; mov To(r5), r2 ; Receiver 4711$: pop call ccon Ret % ;+ ; GeTxNo GetTextNode ; Call r0 => Recever. ; Return r0, r1 => Text node in file 2. ; carry set if no nod was found. ; Uses FB3 and FB4. ;- ;+ Make a copy of the multi-receiver list pointed to by REC(r5) ; and return a pointer to it in REC(r5) ;- ;FixRec: push ; clr FB1-2 ; Cause TryRec to GET first time ; mov REC(r5), r3 ; Current record pointer ; clr r4 ; Next pointer (NIL first time) ;10$: ; gos TryRec <#2, r3, #FB1, #UnLock> ; mov 2(r1), r3 ; Get "old" next-pointer ; mov r4, 2(r1) ; And save the "new" one ; mov r1, r2 ; Save pointer to record ; mov #FB2, r1 ; Use FB2 when spawning ; mov #2, r0 ; Channel #2 ; call Spawn ; Make a node ; mov (r1), r4 ; Make r4 a pointer to this node ; push r3 ; mov #20, r3 ; A LINK node is 20 (16.) words long ;20$: mov (r2)+, (r1)+ ; sob r3, 20$ ; Move the whole record. ; pop r3 ; gos put <#2,,#FB2> ; Make it ; tst r3 ; End of list? ; bne 10$ ; Nope - Go link next @10$ ; mov r4, REC(r5) ; Then fetch the pointer ; pop ; rts pc ; Text TABO, <"Utpl}nar Text "> .end