.TITLE COMPRS COMPRESS OUT BLANKS IN STRING .IDENT /C01/ .ENABL GBL,LC ; AUTHOR: Bradford Castalia ; CHANGES: ; 21-DEC-83 Added CMPRS$ entry point (BC) ; 16-OCT-86 Converted to C-language interface (BC) ; MODULE FUNCTION: ; STRING = COMPRS (STRING) ; STRING The address of the beginning of the character string. .LIST TTM ; TERMINAL LISTING MODE .NLIST BEX ; SUPPRESS BIN EXTENSION ; SYMBOL DEFINITIONS: HT = 11 SPA = 40 ; FUNCTION DETAILS: ; The characters beginning at STRING are scanned for blanks (HT, ; SPA) which are removed from the character string. The function ; returns (in R0) the address of the compressed string. .PSECT C$CODE,I COMPRS:: JSR R5,CSV$ ; Establish C environment MOV C$PMTR(R5),R0 ; R0 <- #STRING ; Assembly language entry point: ; Input - ; R0 - #STRING ; Output - ; R0 - #STRING ; R1 - Destroyed CMPRS$:: MOV R0,R1 ; R1 <- Current char xfer addr SCAN: CMPB #SPA,(R0) BEQ SKIP CMPB #HT,(R0) BEQ SKIP ; The tested character is not blank, so move it to the current xfer addr MOVB (R0),(R1)+ ; Move the character BEQ RET ; End of string SKIP: INC R0 ; Point to next character BR SCAN RET: MOV C$PMTR(R5),R0 JMP CRET$ .END