.TITLE INSCHR -- TECO insert line into screen command .IDENT /M0101/ ; ; This routine is used to insert a line of text into TECO's screen. ; It is used by video text editors to help speed up normal character ; insertion. It is called from WATCH when the syntax "7:W" is detected. ; Note that on lines terminated by an EOB character, the EOB will be ; overwritten. ; .MCALL QIOW$S,DTRG$S .PSECT CODE,I,RO,CON INSCHR:: CMPB #IS.SUC,TTWRAP ; Were we able to set NOACR on the terminal? BEQ 5$ ; If so, can use this logic 3$: JMP 20$ ; Else just do a TLISTN 5$: MOV P(R5),R0 ; Point to where we are in text buffer CMP ZZ(R5),R0 ; Are we at the end of it? BEQ 10$ ; If EQ, we can insert unquestionably. ADD TXSTOR(R5),R0 ; Else point absolutely into buffer CMPB #CR,(R0)+ ; Check next char for BNE 3$ ; If NE, we can't do it CMPB #LF,(R0) ; Check for BNE 3$ ; If NE, no good 10$: MOV X$SIZE,R3 ; Get size of the line. SUB #2.,R3 ; Full line is 2 chars less SUB CURCHR,R3 ; Less what we already have BLE 3$ ; If too few, just get one char. MOV ETYPE(R5),-(SP) ; Save type-out flags BIS #ET.CKE!ET.IMG,ETYPE(R5) ; Say conditional type-in CLR IOSTAT ; Initialize no characters terminating CLR IOSTAT+2 ; Initialize major character counter CLR R1 ; Initialize TLISTN char counter MOV CURABS,R2 ; Point into the screen 12$: CALL TLISTN ; Get a character TST R0 ; Check if we got one BMI 15$ ; If MI, didn't get one CMPB #40,R0 ; Check it for special BGT 17$ ; If GT, character is special CMPB #177,R0 ; Now check if high BNE 19$ ; If NE, not special 17$: MOVB R0,IOSTAT+1 ; Special character gets put away BR 18$ ; Now merge ahead to insert code 19$: MOVB R0,(R2)+ ; So put the character away BIT #ET.NCH,ETYPE(R5) ; Did TIAST echo it? BEQ 7$ ; If EQ, yes. Don't do it here CALL TYPEBF ; Else output it CLR OUTDNE(R5) ; Forget in case implied TYPEBC 7$: INC R1 ; And count it SOB R3,12$ ; Now get another if possible BR 18$ ; If all out of chars, go insert 15$: CALL TYPEBC ; Flush buffer before trying for more. CLR OUTDNE(R5) ; And forget we did it. QIOW$S #IO.RST,#TTYLUN,#TTYEFN,,#IOSTAT,, ; Gather up a bunch of characters 18$: ADD R1,IOSTAT+2 ; Count previous chars in total MOV (SP)+,ETYPE(R5) ; Fix the typeout flags MOV IOSTAT+2,R1 ; Get number of characters we got. BEQ 30$ ; If none, don't insert them MOV P(R5),R2 ; Pick up the text pointer MOV ZZ(R5),R3 ; Get the end of text marker ADD R3,R1 ; Point to new end of text MOV IOSTAT,-(SP) ; Save parms in case sizer does output MOV IOSTAT+2,-(SP) ; Both of them. JSR R4,SIZE ; Now size out the memory. .WORD ZMAX ; Maximum memory size. MOV (SP)+,IOSTAT+2 ; Restore the input parameters MOV (SP)+,IOSTAT ; Both of them. BCS 40$ ; If CS, we got it JMP $E$MEM ; Else we tripped. 40$: MOV R1,ZZ(R5) ; Now replace the end of text MOV TXSTOR(R5),R0 ; Get the text buffer offset CMP R2,R3 ; Check if we are at the end BEQ 70$ ; If so, don't move text ADD R0,R1 ; Make new ZZ absolute ADD R0,R2 ; Make P absolute ADD R0,R3 ; Make old ZZ absolute MOVB (R2),R0 ; Save the char at P CLRB (R2) ; Put a marker in at P 60$: MOVB -(R3),-(R1) ; Move text character up to the end BNE 60$ ; If NE, we can't be done CMP R3,R2 ; Else we might be done BHI 60$ ; If HI, not done yet MOVB R0,(R1) ; Else put saved char away 70$: MOV CURABS,R2 ; Get the input buffer MOV IOSTAT+2,R3 ; Get the number of characters to insert MOV R3,LSCHSZ(R5) ; Save number of chars NEG LSCHSZ(R5) ; Hold negative of last insert MOV P(R5),R1 ; Get pointer to text place ADD TXSTOR(R5),R1 ; Make it absolute ADD R3,PRECOL ; And the last known cursor column ADD R3,P(R5) ; And move the pointer after the text 80$: MOVB (R2)+,(R1)+ ; Move in the text SOB R3,80$ ; Until done 30$: CLR R0 ; Prepare R0 for character input BISB IOSTAT+1,R0 ; Get the character BNE 90$ ; If NE, we got one 20$: CALL TLISTN ; Get a character, regardless 90$: RTS PC ; And leave this mess TERMTP:: ; Terminal typer INC CFLG(R5) ; Got a comma? BEQ 10$ ; If EQ, yes. Go set type CLR R0 ; Else set up R0 for return BISB .TTYPE,R0 ; Return value of terminal type RETURN ; Back to mainline TECO 10$: MOVB M(R5),.TTYPE ; Put away the requested terminal type MOVB M(R5),R0 ; Get it to work on ASL R0 ; Move it up a notch for words BIC #^C<76>,R0 ; MASK OFF TERMINAL BITS CMP R0,#SCRCHL ; Check if terminal type is valid BLT 27$ ; If LT, it is CLR R0 ; Else punt on it 27$: .IF DF MU$TEC DTRG$S #VTXRDB ; Detach the current screen region MOV SCRCHA(R0),VTXFDB+F.FNB+N.FNAM ; Pick up the overlay name CALL VTXLDR ; Load the page .IFF MOV SCRCHA(R0),LDOVRS ;PICK UP THE OVERLAY NAME MOV #LDBLK,R0 ; PICK UP THE LOAD BLOCK ADDRESS CALL $LOAD ; LOAD THE OVERLAY .ENDC CLR NFLG(R5) ; Don't return a value CLR R0 ; Default the screen position RETURN .END