.title fold ; ; this routine implements the following fortran interface ; ; call fold(buf) ; ; where buf is an EOS-terminated string ; ; fold crunches all characters in the range A-Z into lower case ; ap=%5 buf=2 BIGA=101 BIGZ=132 LETA=141 LETZ=172 DIF=LETA-BIGA MASK=177 fold:: mov buf(ap),r1 ; address of buf(1) in r1 10$: movb (r1),r0 ; next character into r0 beq 20$ ; if == 0, then done cmpb r0,#BIGA&MASK ; see if >= A blt 30$ ; if <, then copy character back cmpb r0,#BIGZ&MASK ; see if <= Z bgt 30$ ; if >, then copy character back add #DIF,r0 ; add 40(8) to character 30$: movb r0,(r1)+ ; copy byte back into string br 10$ 20$: return .end