.title strpad ; ; call strpad( a, len, [err] ) ; strpad:: mov (r5)+,r3 ; get nargs mov (r5)+,r1 ; => i/p mov @(r5)+,r2 ; nchrs beq 10$ ; null ? 5$: tstb (r1)+ ; calc length beq 20$ ; br, if at end dec r2 ; dec chr count bne 5$ 10$: cmpb #3,r3 ; 3 args ? bhi 15$ ; br, if more cmp #-1,(r5) ; null arg ? beq 15$ ; br, if yes movb #-1,@(r5)+ 15$: return 20$: dec r1 30$: movb #' ,(r1)+ dec r2 bne 30$ clrb (r1)+ return .end