.TITLE AUXINS - AUX Insertion Routines .IDENT /1.0/ .ENABL LC ;+ ; ; Free software BY ; Project Software & Development, Inc. ; ; This software is furnished for free and may be used and copied as ; desired. This software or any other copies thereof may be provided or ; otherwise made available to any other person. No title to and ; ownership of the software is hereby transferred or allowed. ; ; The information in this software is subject to change without notice ; and should not be construed as a commitment by PROJECT SOFTWARE ; AND DEVELOPMENT, INC. ; ; PROJECT SOFTWARE assumes no responsibility for the use or reliability ; of this software on any equipment whatsoever. ; ; Project Software & Development, Inc. ; 14 Story St. ; Cambridge, Ma. 02138 ; 617-661-1444 ; ; ; Title: AUXINS.MAC ; Author: Robin Miller ; Date: August 6, 1985 ; ; Description: ; ; This module contains the routines for command insertion. ; ;- .ENABL AMA .NLIST BEX .SBTTL INSCHR - Insert a character. ;+ ; ; INSCHR - Insert a character. ; ; This routine is used to insert a character within the command line. ; ; Inputs: ; R3 = The character to insert. ; ; Implicit Inputs: ; CMDPTR = The command line pointer. ; CMDEND = The command line length. ; ; Outputs: ; All registers are preserved. ; ; Implicit Outputs: ; CMDPTR = The adjusted command line pointer. ; CMDEND = The adjusted command line length. ; ;- INSCHR::JSR R2,$SAVVR ; Save R0 - R2. CALL TRMCMD ; Terminate the command line. ; Save character being inserted. MOV #WRKBUF,R0 ; Set the work buffer address. MOV R0,-(SP) ; Save the starting address. MOVB R3,(R0)+ ; Copy character being inserted. ; Append end of command line. MOV #CMDBUF,R1 ; Set the command line address. ADD CMDPTR,R1 ; Index into the command line. MOV R1,-(SP) ; Save command pointer address. CALL MOVEC ; Copy end of command line. MOV R1,R2 ; Save characters to backup. ; Update the command line buffer. MOV (SP)+,R0 ; Set the command line address. MOV (SP),R1 ; Set the work buffer address. CALL MOVEC ; Update the command line. INC CMDPTR ; Update the command pointer. INC CMDEND ; Update end of the command line. ; Update the terminal screen. MOV #FMTBUF,R0 ; Set the output buffer address. MOV (SP)+,R1 ; Set the work buffer address. CALL MOVEF ; Copy and format the buffer. MOV R2,R1 ; Set characters to backup. BEQ 100$ ; If EQ, end of command line. CALL CLEFT ; Set to move the cursor left. 100$: JMP VTYPE ; Update the terminal screen. .SBTTL INSSTR - Insert a string. ;+ ; ; INSSTR - Insert a string. ; ; This routine is used to insert a string within the command line. ; ; Inputs: ; R2 = Address of string to insert. ; ; Implicit Inputs: ; CMDPTR = The command line pointer. ; CMDEND = The command line length. ; ; Outputs: ; All registers are preserved. ; ; Implicit Outputs: ; CMDPTR = The adjusted command line pointer. ; CMDEND = The adjusted command line length. ; ;- INSSTR::JSR R2,$SAVVR ; Save R0 - R2. CALL TRMCMD ; Terminate the command line. ; Copy the string being inserted. MOV #WRKBUF,R0 ; Set the work buffer address. MOV R0,-(SP) ; Save the starting address. MOV R2,R1 ; Set address of insert string. CALL MOVEC ; Copy the string being inserted. MOV R1,R2 ; Save the insert string size. ; Append end of command line. MOV #CMDBUF,R1 ; Set address of command line. ADD CMDPTR,R1 ; Set pointer into command line. MOV R1,-(SP) ; Save command pointer address. ADD R2,CMDPTR ; Update the command pointer. ADD R2,CMDEND ; Update end of the command line. CALL MOVEC ; Append end of command line. MOV R1,R2 ; Save characters to backup. ; Update the command line buffer. MOV (SP)+,R0 ; Set command pointer address. MOV (SP),R1 ; Set the work buffer address. CALL MOVEC ; Update the command line. ; Update the terminal screen. MOV #FMTBUF,R0 ; Set the output buffer address. MOV (SP)+,R1 ; Set the work buffer address. CALL MOVEF ; Copy and format the buffer. MOV R2,R1 ; Set characters to backup. BEQ 100$ ; If EQ, at end of line. CALL CLEFT ; Set to move the cursor left. 100$: JMP VTYPE ; Update the terminal screen. .SBTTL TRMCMD - Terminate the command line. ;+ ; ; TRMCMD - Terminate the command line. ; ; This routine is used to terminate the command line buffer. This ; routine is used by those routines which presume the command buffer ; is terminated by a null. ; ; Implicit Inputs: ; CMDBUF = The command line buffer. ; CMDEND = The command line size. ; ; Outputs: ; All registers are preserved. ; ;- TRMCMD::JSR R2,$SAVVR ; Save R0 - R2. MOV #CMDBUF,R0 ; Set command line address. ADD CMDEND,R0 ; Point to end of command. CLRB (R0) ; Terminate the command line. RETURN .SBTTL VALCTR - Validate control characters. ;+ ; ; VALCTR - Validate control characters. ; ; This routine validates control characters which are not defined to ; a command or a string. If the character is accepted, it is displayed ; and included in the command byte count. ; ; Inputs: ; R1 = The command byte count. ; R3 = Control character to validate. ; R5 = The ending command line address. ; ; Implicit Inputs: ; CMDPTR = The command line pointer. ; CMDEND = The command line length. ; ; Outputs: ; C bit clear/set = accept/reject control character. ; R1 = The adjusted byte count if accepted. ; ; All other registers are preserved. ; ; Implicit Outputs: ; CMDPTR = The adjusted command line pointer. ; CMDEND = The adjusted command line length. ; ;- VALCTR::JSR R5,$SAVRG ; Save R3 - R5. ; Skip spaces and tabs at the beginning of a command line. TST R1 ; Is this the first character ? BNE 10$ ; If NE, no (skip next check). CMPB #HT,R3 ; Is first character a tab ? BEQ 90$ ; If EQ, yes (discard it). CMPB #SPACE,R3 ; Is first character a space ? BEQ 90$ ; If EQ, yes (discard it). ; Check for valid control characters in command line. 10$: CMPB R3,#HT ; Horizontal tab character ? BEQ 20$ ; If EQ, yes. CMPB R3,#CR ; Carraige return character ? BEQ 20$ ; If EQ, yes. CMPB R3,#SPACE ; Is it a space character ? BNE 90$ ; If NE, no (reject it). ; Check for insert or overprint mode. 20$: BIT #B.IMOD,SWMASK ; Are we in insertion mode ? BEQ 30$ ; If EQ, no (overprint mode). CLRB (R5) ; Terminate the command line. CALL INSCHR ; Yes, insert the character. BR 40$ ; And use common code ... ; Overprint mode, overwrite character. 30$: CALL TYPCHR ; Display the control character. CMP CMDPTR,CMDEND ; Overprint at end of line ? BEQ 35$ ; If EQ, yes. ; Overprint in middle of command line. CLRB (R5) ; No, terminate the command line. MOV #CMDBUF,R5 ; Set the command line address. ADD CMDPTR,R5 ; Index to character to overprint. MOVB R3,(R5) ; Overprint the character. 35$: INC CMDPTR ; Update the command pointer. INC CMDEND ; Update end of the command line. 40$: INC R1 ; Include control key in byte count. CLC ; Show character was accepted. BR 100$ ; Use common return ... 90$: SEC ; Show character being disgarded. 100$: RETURN .END