.title streq .psect $code,rd,nowrt,exe,pic,shr,byte ; /* ; * Compare strings: s1 == s2 => 1, st != s2 => 0 ; */ ; ; streq(s1, s2) ; register char *s1, *s2; ; { ; ; while (*s1 == *s2++) ; if (*s1++=='\0') ; return(1); ; return(0); ; } .entry streq,^M locc #0,#-1,@4(ap) ; find end of s1 subl3 4(ap),r1,r2 ; r2 := length of s1 locc #0,#-1,@8(ap) ; find end of s2 subl2 8(ap),r1 ; r1 := length of s2 cmpl r1,r2 ; Are they equal length? bneq not ; Can't be equal if not. cmpc5 r2,@4(ap),#0,r1,@8(ap) ; compare the strings bneq not ; Br if they're unequal. movzbl #1,r0 ; Equal, return TRUE ret ; not: clrl r0 ; Not equal, return FALSE ret .end