.title setdef .inclu "b:global" sect code ;+ Setdef - Setup or modify a terminal definition. ; ; Data passed: ; r1 - Pointer to TERMINAL node in memory. ; If 30(r1) is 0 -> This is a NEW definition. ;- oSeDef: push mov r1, r5 ; Remember the location of the node mov #TTflst, r2 ; Address of the TT flag list 10$: mov r2, r1 beq 40$ ; We're finished if zero call getadr ; Get a proper address mov rNxt(r1), r2 ; Fetch the next pointer. mov (r1), r3 mov r1, r0 add #rStr, r0 tst 30(r5) ; A new one? beq 21$ bit r3, 4(r5) ; Is this flag set? beq 20$ write #Ejt 20$: mov r0, r1 call strout ; Print it! call PCRLF mov #chp, r4 ; r4 is a pointer to the prompt br 25$ 21$: push r0 ; Save the string pointer mov #spcyes, r0 ; I'll improve this later.. mov #PrsPro, r1 call movstr pop r0 call movstr movb spcyes, (r1) mov r1, r4 25$: PARSER #JANEJL,#-1,r4 call PCRLF tst level beq 10$ ; Just CR means no change call yesnop beq 30$ ; EQ means NO ; The Yes section tst 30(r5) beq 29$ xor r3, 4(r5) ; Yes! 29$: br 10$ 30$: tst 30(r5) bne 29$ bis r3, 4(r5) br 10$ 40$: clr r0 tst 30(r5) ; A new definition? beq 44$ write #nlin1 clr r1 bisb 26(r5), r1 call deco16 call PCRLF mov #nlin2, r4 br 46$ 44$: mov #nlin3, r4 movb #24., 26(r5) ; Default 24 lines. 46$: PARSER #hetlst,#-1,r4 call PCRLF tst level ; Just CR means no change beq 50$ call gval movb r0, 26(r5) 50$: clr r0 tst 30(r5) beq 54$ write #ncol1 clr r1 bisb 27(r5), r1 call deco16 call PCRLF mov #ncol2, r4 br 55$ 54$: mov #ncol3, r4 movb #80., 27(r5) ; Default: 80 columns 55$: PARSER #hetlst,#-1,r4 call PCRLF tst level beq 60$ call gval ; This requires that r0 is 0 movb r0, 27(r5) 60$: mov #Seqlst, r1 mov r5, r3 add #32, r3 ; r3 points at old definition mov #prspro, r2 ; r2 points to temporary buffer 63$: call getadr ; Don't destroy r1!!! tst 30(r5) ; New or change? beq 65$ push r3 mov r3, r4 movb (r4), r3 bic #^c177, r3 call prtseq mov #nseq, r4 pop r3 br 67$ 65$: push r1 mov #prspro+41., r4 mov #31., r0 66$: movb #40, (r4)+ sob r0, 66$ mov r1, r0 add #rStr, r0 mov #prspro+40., r1 call movstr mov r1, r4 movb #31., (r4) pop r1 67$: PARSER #TDslst,#-1, r4 call PCRLF tst level bne 70$ tst 30(r5) ; A new one? beq 70$ ; Then put a zero sequence call movseq ; Copy this sequence from previous br 80$ 70$: call putseq call skpseq ; Skip the sequence (pointed to by r3 80$: mov rNxt(r1), r1 bne 63$ mov #2, 30(r5) ; 2 sequences mov #prspro, r3 mov r5, r2 add #32, r2 call movseq call movseq pop rts pc yesnop: mov found, r1 call getadr tst (r1) rts pc movseq: push r0 ; Move from @r3 to @r2 clr r0 bisb (r3), r0 bic #200, r0 inc r0 10$: movb (r3)+, (r2)+ sob r0, 10$ pop r0 rts pc skpseq: push r0 clr r0 bisb (r3)+, r0 bic #200, r0 beq 20$ 10$: inc r3 sob r0, 10$ 20$: pop r0 rts pc putseq: push movb level, (r2)+ beq 20$ clr r3 10$: mov r3, r0 asl r0 mov found(r0), r1 call getadr tst (r1) beq 15$ bpl 13$ ; If negative - "It's missing" clrb -1(r2) br 20$ 13$: mov (r1), r0 br 17$ 15$: call gval 17$: bis #200, r0 ; RSTS/E prefers chars > 127. movb r0, (r2)+ inc r3 cmp r3, level blo 10$ 20$: pop rts pc sect texts,d Text spcyes, <" "> Text nlin2, <"Nytt antal rader "> Text nlin3, <"Antal rader <24>"> Text ncol2, <"Nytt antal kolumner "> Text ncol3, <"Antal kolumner <80>"> ;Text pagseq, <"Sekvens f|r radera sk{rmen "> ;Text linseq, <"Sekvens f|r radera raden "> Text nseq, <"Ny sekvens "> .even .end