.title LENGTH ; ; LENGTH scans a character string and returns a pointer to the ; last non-blank, non-null, non-Tab character. ; ; Calling Sequence: ; ; len.wlc.v = length (string.rt.dx) ; ; len = last non-blank pointer, 0 if all blanks ; string = string to search ; ; Written by Art Moorshead ; STRING = 4 BLANK = 32 .psect $code, nowrt, exe, long, pic, shr .entry length, ^m<> movq @STRING (ap), r0 ; get string descriptor movzwl r0, r0 ; string length addl2 r0, r1 ; address of end of string brb 20$ 10$: cmpb -(r1), #BLANK ; Greater than Blank? bgtru 30$ ; Yes, exit 20$: sobgeq r0, 10$ ; No, try next character 30$: incl r0 ; Correct the offset ret .end