;---------------------------------------------------------
; String length function works on the global string 
; (defined in the C function). It returns string length.
;---------------------------------------------------------
.MODEL SMALL
.DATA
	EXTRN   _string:byte
.CODE
PUBLIC  _string_length
_string_length  PROC
	mov     AX,0              ; AX keeps the character count
	mov     BX,OFFSET _string ; load BX with string address 
repeat1:
	cmp     BYTE PTR[BX],0    ; compare with NULL character
	jz      done
	inc     AX                ; increment string length
	inc     BX                ; inc. BX to point to next char.
	jmp     repeat1
done:
	ret
_string_length  ENDP
	END
