.title length ; ; function to return the length of an EOS-terminated string ; ; n = length(str) ; ; where str is the address of the string ; eos=0 str=4 .psect st_pure_code rel,con,lcl,exe,nowrt,rd,pic,shr,usr,novec,long .entry length ^m<> movl str(ap),r1 ; address of string clrl r0 ; initialize length 10$: incl r0 ; increment length tstb (r1)+ ; see if at EOS bneq 10$ ; NO decl r0 ; went one too far ret .end