.title indexx ; ; this routine provides the following interface ; ; i = indexx(buf, char) ; ; where buf is an EOS-terminated string ; if found, return(i) such that buf(i) == char ; else return(0) ; buf=4 char=8 eos=0 .psect st_pure_code rel,con,lcl,exe,nowrt,rd,pic,shr,usr,novec,long .entry indexx ^m movl buf(ap),r1 ; address of buf(1) movzbl @char(ap),r2 ; character to find clrl r0 ; initialize character position 10$: incl r0 ; increment to current character pos tstb (r1) ; see if at EOS beql 20$ ; YES cmpb (r1)+,r2 ; is this the character? beql 30$ ; YES, return brb 10$ ; try again 20$: clrl r0 ; character not found 30$: ret .end