.TITLE AUXDEL - Delete Commands. .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: AUXDEL.MAC ; Author: Robin Miller ; Date: August 3, 1985 ; ; Description: ; ; This module contains the routines for deleting command line text. ; ;- .ENABL AMA .NLIST BEX ; Local messages: DELSEQ: .BYTE BS,SPACE,BS,0 ; Delete character from screen. .EVEN .SBTTL DBWCMD - Delete the previous word. ;+ ; ; DBWCMD - Delete the previous word. ; ; This routine is used to delete the previous word from the screen. ; ; Implicit Inputs: ; CMDPTR = The command line pointer. ; CMDEND = End of the command line. ; ; Implicit Outputs: ; CMDPTR = The adjusted command line pointer. ; CMDEND = The adjusted end of command line. ; ;- DBWCMD::JSR R5,$SAVRG ; Save R3 - R5. CALL BCKWRD ; Backup over previous word. BCS 100$ ; If CS, no word was skipped. ; Calculate the command line variables. SUB R3,CMDPTR ; Adjust the command pointer. SUB R3,CMDEND ; Adjust end of command line. MOV R0,-(SP) ; Save the starting address. MOV #WRDBUF,R4 ; Set deleted word buffer addr. MOV R3,R2 ; Copy the character count. ; Save the word in the deleted word buffer. 10$: MOVB (R0)+,(R4)+ ; Save the word to be deleted. SOB R2,10$ ; Loop until we're done. CLRB (R4) ; Terminate deleted word buffer. ; Update the command line. MOV (SP),R0 ; Restore the buffer address. CALL MOVEC ; Update the command buffer. ; Update the terminal screen. MOV #FMTBUF,R0 ; Set the output buffer address. MOV R3,R1 ; Copy the character count. CALL CLEFT ; Point in front of word. MOV (SP)+,R1 ; Set the starting address. CALL MOVEF ; Copy rest of command line. CALL CEOL ; Clear to end of command line. TST R1 ; Were we at end of line ? BEQ 20$ ; If EQ, yes (leave cursor). CALL CLEFT ; Position cursor into line. 20$: MOV #-1,WRDDIR ; Set direction of this delete. JMP VTYPE ; Update screen and return. 100$: RETURN .SBTTL DELCMD - Delete the previous character. ;+ ; ; DELCMD - Delete the previous character. ; ; This routine is used to delete the previous character from the screen. ; ; Implicit Inputs: ; CMDEND = The command line size. ; CMDPTR = The command line pointer. ; ; Outputs: ; Registers R0 - R2 are destroyed. ; ; All other registers are preserved. ; ;- DELCMD::JSR R5,$SAVRG ; Save R3 - R5. MOV CMDEND,R1 ; Copy the command line size. TST R1 ; Any more characters to delete ? BEQ 100$ ; If EQ, no (no action). MOV BUFSAV,R0 ; Copy the starting buffer address. MOV R0,R2 ; Copy the starting address. ADD R1,R2 ; Point to end of command line. CMP CMDPTR,CMDEND ; Deleting at end of the line ? BEQ 20$ ; If EQ, yes. ; Delete character in middle of command line. TST CMDPTR ; Pointing at start of line ? BEQ 100$ ; If EQ, yes (no action). MOV R0,R3 ; Copy the buffer address. ADD CMDPTR,R3 ; Index into the command line. MOV R3,R1 ; Save starting address to copy. MOVB -(R3),CHRBUF ; Save character being deleted. MOV #FMTBUF,R0 ; Set the output buffer address. MOVB #BS,(R0)+ ; Backup one character position. CALL MOVEF ; Copy the string. Length --> R1. CALL CEOL ; Clear to end of the line. CALL CLEFT ; Get ready to move cursor left. CALL VTYPE ; Update the terminal screen. 10$: MOVB 1(R3),(R3)+ ; Delete character in buffer. BNE 10$ ; Loop until we're done. BR 30$ ; Use common code ... ; Delete character at end of command line. 20$: MOV #DELSEQ,R4 ; Set delete sequence address. CALL WRITE ; Write the delete sequence. MOV R2,R3 ; Copy the buffer address. MOVB -(R3),CHRBUF ; Save character being deleted. CMPB (R3),#SPACE ; Deleting a control character ? BHIS 30$ ; If HIS, no. CALL CHKGRA ; Character displayed in graphics ? BCC 30$ ; If CC, yes. CALL WRITE ; No, delete the up arrow. ; Adjust the command byte count and the command pointer. 30$: DEC CMDEND ; Adjust the command line size. DEC CMDPTR ; Adjust the command pointer. MOV #-1,CHRDIR ; Set direction of this delete. 100$: RETURN .SBTTL DELWRD - Delete the next word. ;+ ; ; DELWRD - Delete the next word. ; ; This routine is used to delete the next word from the screen. ; ; Implicit Inputs: ; CMDPTR = The command line pointer. ; CMDEND = End of the command line. ; ; Implicit Outputs: ; CMDPTR = The adjusted command line pointer. ; CMDEND = The adjusted end of command line. ; ;- DELWRD::JSR R5,$SAVRG ; Save R3 - R5. CALL ADVWRD ; Advance over next word. BCS 100$ ; If CS, no word skipped. ; Calculate the command line variables. SUB R3,CMDEND ; Adjust end of command line. MOV R0,-(SP) ; Save the starting address. MOV #WRDBUF,R4 ; Set deleted word buffer addr. MOV R3,R2 ; Copy the character count. ; Save the word in the deleted word buffer. 10$: MOVB (R0)+,(R4)+ ; Save the word to be deleted. SOB R2,10$ ; Loop until we're done. CLRB (R4) ; Terminate deleted word buffer. ; Update the command line. MOV (SP),R0 ; Restore starting buffer address. CALL MOVEC ; Update the command buffer. ; Update the terminal screen. MOV #FMTBUF,R0 ; Set the output buffer address. MOV (SP)+,R1 ; Set the starting address. CALL MOVEF ; Copy rest of command line. CALL CEOL ; Clear to end of command line. TST R1 ; Were we at end of line ? BEQ 20$ ; If EQ, yes (leave cursor). CALL CLEFT ; Position cursor into line. 20$: CLR WRDDIR ; Set direction of this delete. JMP VTYPE ; Update screen and return. 100$: RETURN ; ; Action routines for TPARS. ; Registers R0, R1, and R2 may be used by the action routines. ; All other registers must be preserved. ; ;****************************************************************************** ; Delete to beginning of the command line. DELBOL::MOV CMDPTR,R2 ; Copy the command line pointer. BEQ 100$ ; If EQ, at beginning of the line. CMP R2,CMDEND ; Are we at end of command line ? BEQ DELLIN ; If EQ, yes (delete entire line). ; Save the text being deleted. MOV #LINBUF,R0 ; Set deleted line buffer address. MOV #CMDBUF,R1 ; Set the command line buffer. MOV R1,-(SP) ; Save the command line address. 10$: MOVB (R1)+,(R0)+ ; Copy start of command line. SOB R2,10$ ; Loop until we're done. CLRB (R0) ; Terminate the delete buffer. ; Update the command line buffer. MOV (SP),R0 ; Set starting command address. MOV R0,R1 ; Copy the starting address. ADD CMDPTR,R1 ; Index into the command line. CALL MOVEC ; Update the command line. MOV R1,CMDEND ; Set new ending command line size. MOV CMDPTR,R1 ; Copy positions to start of line. CLR CMDPTR ; Set pointer to beginning of line. MOV #-1,LINDIR ; Set direction of this delete. ; Update the terminal screen. MOV #FMTBUF,R0 ; Set the output buffer address. CALL CLEFT ; Move cursor to beginning of line. MOV (SP)+,R1 ; Set the command pointer address. CALL MOVEF ; Copy and format the command line. CALL CEOL ; Clear to the end of the line. CALL CLEFT ; Put cursor at beginning of line. JMP VTYPE ; Now update the terminal screen. 100$: RETURN .SBTTL DELCHR - Delete character forward. ;****************************************************************************** ; Delete character forward. DELCHR::TST CMDEND ; Is there anything to delete ? BEQ 100$ ; If EQ, no (no action). CMP CMDPTR,CMDEND ; At end of the command line ? BEQ 100$ ; If EQ, yes (no action). ; Update the command line buffer. MOV #CMDBUF,R0 ; Set the command line address. ADD CMDPTR,R0 ; Index into the command line. MOV R0,-(SP) ; Save command pointer address. MOV R0,R1 ; Copy command pointer address. MOVB (R1)+,CHRBUF ; Save character being deleted. CALL MOVEC ; Update the command line buffer. DEC CMDEND ; Adjust end of the command line. CLR CHRDIR ; Set direction of this delete. ; Update the terminal screen. MOV #FMTBUF,R0 ; Set the output buffer address. MOV (SP)+,R1 ; Set command pointer address. CALL MOVEF ; Copy and format the buffer. CALL CEOL ; Set to clear the end of the line. TST R1 ; Were there any characters copied ? BEQ 10$ ; If EQ, no (don't move the cursor). CALL CLEFT ; Move cursor to deleted character. 10$: JMP VTYPE ; Now update the terminal screen. 100$: RETURN .SBTTL DELEOL - Delete to end of the line. ;****************************************************************************** ; Delete to end of the line. DELEOL::MOV CMDPTR,R2 ; Copy the command line pointer. CMP R2,CMDEND ; Is there anything to delete ? BEQ 100$ ; If EQ, no (no action). ; Save the text being deleted. MOV #LINBUF,R0 ; Set deleted line buffer address. MOV #CMDBUF,R1 ; Set the command line buffer. ADD R2,R1 ; Point into the command line. CALL MOVEC ; Copy end of the command line. ; Update the terminal screen. MOV R2,CMDEND ; Set the new end of command line. MOV #FMTBUF,R0 ; Set the output buffer address. CALL CEOL ; Set to clear to end of the line. CLR LINDIR ; Set direction of this delete. JMP VTYPE ; Now go update the terminal screen. 100$: RETURN .SBTTL DELLIN - Delete the entire command line. ;****************************************************************************** ; Delete the entire command line. DELLIN::TST CMDEND ; Is there anything to delete ? BEQ 100$ ; If EQ, no (no action). ; Save the text being deleted. MOV #LINBUF,R0 ; Set deleted line buffer address. MOV #CMDBUF,R1 ; Set the command line buffer. CALL MOVEC ; Copy the entire command line. ; Update the terminal screen. MOV #FMTBUF,R0 ; Set the output buffer address. MOV CMDPTR,R1 ; Copy the command line pointer. BEQ 10$ ; If EQ, we're at start of line. CALL CLEFT ; Move cursor to start of line. 10$: CALL CEOL ; Set to clear to end of the line. CLR CMDPTR ; Clear the command line pointer. CLR CMDEND ; Clear end of the command line. MOV #-1,LINDIR ; Set direction of this delete. JMP VTYPE ; Now, update the terminal screen. 100$: RETURN .SBTTL UNDCHR - Undelete a character. ;****************************************************************************** ; Undelete character. UNDCHR::MOVB CHRBUF,R3 ; Copy the character to insert. BEQ 100$ ; If EQ, there is none. CALL INSCHR ; Insert and update the screen. ; If last delete was forward, backup the cursor position. TST CHRDIR ; Was the last delete backward ? BNE 100$ ; If NE, yes (leave cursor). MOV #FMTBUF,R0 ; Set the output buffer addres. MOV #1,R1 ; Set number of positions to move. CALL CLEFT ; Backup the cursor position. SUB R1,CMDPTR ; Adjust command line pointer. JMP VTYPE ; Update the terminal screen. 100$: RETURN .SBTTL UNDLIN - Undelete a line. ;****************************************************************************** ; Undelete line. UNDLIN::MOV #LINBUF,R0 ; Set address of string to insert. CALL GETLEN ; Get the string length into R1. TST R1 ; Is there anything to insert ? BEQ 100$ ; If EQ, no (no action). MOV R0,R2 ; Yes, copy the string address. CALL INSSTR ; Insert string & update the screen. ; If last delete was forward, backup the cursor position. TST LINDIR ; Was the last delete backward ? BNE 100$ ; If NE, yes (leave cursor). MOV #FMTBUF,R0 ; Set the output buffer addres. CALL CLEFT ; Backup the cursor position. SUB R1,CMDPTR ; Adjust command line pointer. JMP VTYPE ; Update the terminal screen. 100$: RETURN .SBTTL UNDWRD - Undelete a word. ;****************************************************************************** ; Undelete word. UNDWRD::MOV #WRDBUF,R0 ; Set address of string to insert. CALL GETLEN ; Get the string length into R1. TST R1 ; Is there anything to insert ? BEQ 100$ ; If EQ, no (no action). MOV R0,R2 ; Yes, copy the string address. CALL INSSTR ; Insert string & update the screen. ; If last delete was forward, backup the cursor position. TST WRDDIR ; Was the last delete backward ? BNE 100$ ; If NE, yes (leave cursor). MOV #FMTBUF,R0 ; Set the output buffer addres. CALL CLEFT ; Backup the cursor position. SUB R1,CMDPTR ; Adjust command line pointer. JMP VTYPE ; Update the terminal screen. 100$: RETURN .END