.TITLE ASKPAD ; ; .IDENT /Y07.00/ ; ; ; .ENABL LC ; ; ; Copyright (C) Shell Research Ltd. 1982 ; ; ; The copyright in this computer program and associated user ; instructions contained in this document is the property of ; Shell Research Ltd.. No guarantee is given or may be implied ; as to the adequacy of the program or its suitability for any ; particular purpose and no liability is accepted for any loss ; or damage arising out of its use. ; ; ; ; Version: Y07 ; ; ; Original author: R J Carpenter 11-Oct-82 ; ; ; This version: Ray Carpenter 29-Feb-84 ; ; .PAGE .SBTTL Description ; ; ;++ ; This subroutine pads ASCII strings with spaces to be a specified ; length. ; ; Macro Call: CALL $ASKPD ; ; On Entry: ; ; R0 contains length (in bytes) to pad to. ; ; ; Errors: ; ; None reported, although the no action occurs if the current length is ; equal to or greater than the maximum length, or the maximum length is ; < 1 ; ;-- ; .psect $ask$ ; $ASKPD:: tst r0 ;maxlen valid ? ble 20$ ;noop if < 1 mov #qlin,r1 ;set up start addr. of string mov ipoint,r2 ;current length sub r2,r0 ;anything to pad ? ble 20$ ;br if not add r2,r1 ;point r1 at end of string ; 10$: movb #40,(r1)+ ;add space to string dec r0 ;more ? bne 10$ ; clrb (r1) ;add null terminator ; ; 20$: return ;return to caller ; ; .end