.TITLE STDELE .IDENT /V02/ .ENABLE LC ; ; This module removes a substring from within an ASCII string ; ; Author: V01 16-Mar-79 Mark Woolfson ; V02 28-Jan-80 Phil Stephensen-Payne ; ; Calling Sequence: ; ; This subroutine is called via the standard FORTRAN calling sequence as:- ; ; CALL STDELE(STADDR,DELLEN,RSTLEN [,STATUS]) ; or ; STATUS = STDELE(STADDR,DELLEN,RSTLEN) ; ; Where:- ; STADDR = Start address of section to be deleted ; DELLEN = Number of bytes to be deleted (0-255) ; RSTLEN = Lenth of strin after section to be deleted (0-255) ; STATUS = Optional error return ; ; Errors Returned: ; ; STATUS = 0 if the operation was successful ; = -1 if a parameter error was detected ; ; External References: ; ; This module calls the subroutine PRMCHK. ; ; STDELE:: MOV #4.,R0 ;SET UP NUMBER OF PARAMS CALL PRMCHK ;CHECK ON PARAMETERS BCS 30$ ; If CS parameter error - exit at once TST (R5)+ ; Throw away number of parameters MOV (R5)+, R2 ;GET ADDR OF STRING MOVB @(R5)+, R1 ;GET LENGTH OF DELETION BIC #177400,R1 ;Clear any sign extension BEQ 30$ ;NOTHING TO DO MOV R1,R4 ; Store length to be deleted ADD R2, R1 ;POINT AT NEW START MOVB @(R5)+, R3 ;GET LENGTH TO MOVE BIC #177400,R3 ; Clear any sign extension BEQ 20$ ; If eqnnothing to move - just delete ; 10$: MOVB (R1)+, (R2)+ ;COPY A BYTE SOB R3,10$ ;CHECK FOR END OF MOVE ; 20$: CLRB (R2)+ ;FILL WITH NULLS SOB R4,20$ ;CHECK FOR END OF FILL ; 30$: RETURN ;QUIT .END