;
; STRIPS.M68
;
; This subroutine does a reverse strip on a string .
; what it does is takes all leading blanks , control characters
; and strips them out,then it pads the string with the pad character
; you specified.
;
; FORMAT : XCALL STRIPS,STRING,PADCHR
;
; 07/16/87 flm(bb)
;
; Author : Fred L. McMaster (A.K.A.'BIBI') Computer Resources,Inc.
; 101 39th Street North
; Birmingham , AL 35222
; (205) 591-8810
;
STRIPS: CMMW XC.ARG(A3),#2 ; Test for at least one arg
JLO ARGERR ; if not report it
STR1: CMMW XC.TY1(A3),#2 ; test for string type(source)
JNE TYPERR ; if not report it
MOV XC.SZ1(A3),D0 ; set source byte count
MOV XC.AD1(A3),A2 ; move source variable into A2
MOV XC.AD1(A3),A4 ; move dest. variable into a4
CLR D2 ; clear secondary register
START: DEC D0 ; decrement byte count by 1
MOVB (A2)+,D1 ; move first byte into d1
CMPB D1,#40 ; compare with space
BLE START ; if it's a space or less(ctrl char)
; then get next char.
MOVB D1,(A4)+ ; put byte into destination buffer
10$: INC D2 ; increment byte count for output by 1
MOVB (A2)+,(A4)+ ; this is the main loop
SOB D0,10$ ; subtract one and branch until
; the entire string is done.
MOV XC.SZ1(A3),D0 ; set string length
CLR @A2 ; clear the register
MOV XC.AD2(A3),A2 ; push address into A2
20$: CMPW D2,D0 ; compare length's
BEQ 30$ ; exit if same
MOVB (A2),(A4)+ ; space is pad character
INC D2 ; increment byte count
BR 20$
30$: RTN ; return from calling program.
DEFINE ERROR TEXT
TYPE <'TEXT' >
JMP ABORT
ENDM
ARGERR:ERROR An improper number of arguments has been passed to
VARERR:ERROR An argument type error has occurred in
SIZERR:ERROR An argument size error has occurred in
TYPERR:ERROR A variable type error has occurred in
ABORT: TYPECR <STRIPS.SBR>
TYPECR < 1987 Computer Resources, Inc. > ; or any other verbage