DIS MACRO STR
MOV AH,09H
LEA DX,STR
INT 21H
ENDM
DATA SEGMENT
MSG1 DB "ENTER STRING : $"
MSG2 DB "THE LENGTH OF STRING IS : $"
STR1 DB "HARDIK$"
LINE DB 10,13,'$'
DATA ENDS
CODE SEGMENT
LENGTH1 PROC NEAR
ASSUME CS:CODE
MOV CL,00
MOV AH,'$'
L1:CMP BYTE PTR[SI],AH
JE L2
INC CL
INC SI
JMP L1
L2:RET
LENGTH1 ENDP
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
DIS MSG1
DIS STR1
DIS LINE
DIS MSG2
LEA SI,STR1
CALL LENGTH1
ADD CL,'0'
MOV AH,02H
MOV DL,CL
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
;------
;OUTPUT
;------
ENTER STRING : JINESH
THE LENGTH OF STRING IS : 6