.title strcmp ;+ ; integer function strcmp(str1, str2) ;- str1=4 str2=8 .psect st_pure_code rel,con,lcl,exe,nowrt,rd,pic,shr,usr,novec,long .entry strcmp ^m movl str1(ap),r1 ; start of str1 movl str2(ap),r2 ; start of str2 clrl r0 ; assume equal 10$: cmpb (r1),(r2) ; characters equal? bneq 20$ ; NO tstb (r1)+ ; at EOS? beql 100$ ; YES incl r2 ; bump address to next character brb 10$ 20$: movl #-1,r0 ; assume str1 < str2 cmpb (r1),(r2) ; compare characters blss 100$ ; str1 < str2 movl #1,r0 ; return(+1) 100$: ret .end