; -- strlen(s) returns the length of null terminated string s ; version 2, using pointer incrementing to advance through string STRLEN: ; expects R3 = s, a pointer to a string ; returns R3 = i, the length of s ; uses R5 = s[i], successive values ; R6 = i, during the code LIS R6,0 ; i = 0 STRLLP: ; loop { LOADS R5,R3 ; -- get word holding *s EXTB R5,R5,R3 ; -- get *s BZS STRLQT ; if (*s == 0) break ADDSI R6,1 ; i = i + 1 ADDSI R3,1 ; s++ BR STRLLP STRLQT: ; } MOVE R3,R6 ; -- move return value into place JUMPS R1 ; return i