How To Find Length Of String In 8086 Assembly Language [Click to Download Code]
This program prints the length of user input string in 8085/8086 microprocessor assembly language programming
TITLE PUCHTAA
.MODEL SMALL
.STACK 100H
.DATA
MSG1 DB 0AH, 0DH, "ENTER A STRING--> $"
MSG2 DB 0AH, 0DH, "NUMBER OF CHARACTERS ENTERED--> $"
INMSG DB 25 DUP('0')
.CODE
MAIN:
MOVAX, @DATA
MOVDS, AX;----------------DISPLAY THE MESSAGE------------------
AGAIN:
LEADX, MSG1
MOVAH, 09H
INT 21H
;----------------------------------------------------- ;-----------TAKE STRING INPUT------------------------ LEASI, INMSG
MOVDX, SIMOVAH, 0AH
INT 21H
MOVSI, 02H
CMP INMSG+SI, 0DH
JE EXIT
;--------------------------------------------------- LEADX, MSG2
MOVAH, 09H
INT 21H
;----------SET SOURCE INDEX(SI) VALUE TO 1---------- ;----------BECAUSE FIRST INDEX TELLS NUMBER OF BYTES READ-------- MOVSI,01H
MOVAL, INMSG+SIMOVAH, 00H
MOVBL, 0AH ; AAD; DIVBL;BREAKING THE VALUE IF IT EXCEEDS 10 ;-------------------------------------------------------- MOVDX, AXADDDL, 30H
MOVAH, 02H
INT 21H
MOVDL, DHADDDL, 30H
MOVAH, 02H
INT 21H
JMP AGAIN
EXIT:
MOVAH, 04CH
INT 21H
END MAIN
No comments:
Post a Comment