Thursday, March 26, 2020

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: 
        MOV AX, @DATA 
        MOV DS, AX 
;----------------DISPLAY THE MESSAGE------------------ 
   AGAIN:      
        LEA DX, MSG1 
        MOV AH, 09H 
        INT 21H 
;----------------------------------------------------- 
         
;-----------TAKE STRING INPUT------------------------         
        LEA SI, INMSG 
        MOV DX, SI 
        MOV AH, 0AH 
        INT 21H 
         
        MOV SI, 02H 
        CMP INMSG+SI, 0DH 
        JE EXIT 
;---------------------------------------------------         
        LEA DX, MSG2 
        MOV AH, 09H 
        INT 21H 
;----------SET SOURCE INDEX(SI) VALUE TO 1---------- 
;----------BECAUSE FIRST INDEX TELLS NUMBER OF BYTES READ--------         
        MOV SI,01H 
         
        MOV AL, INMSG+SI 
        MOV AH, 00H 
        MOV BL, 0AH ; 
        AAD         ; 
        DIV BL      ;BREAKING THE VALUE IF IT EXCEEDS 10 
;--------------------------------------------------------         
        MOV DX, AX 
        ADD DL, 30H 
        MOV AH, 02H 
        INT 21H 
         
        MOV DL, DH 
        ADD DL, 30H 
        MOV AH, 02H 
        INT 21H 
        JMP AGAIN 
   EXIT:      
         
        MOV AH, 04CH 
        INT 21H 
    END MAIN


TAGS:
  • find length of string in assembly language 8086
  • 8086 program to find length of a string
  • length of string in assembly language
  • string length assembly
  • assembly get length of string
  • length of string assembly
  • assembly length of string
  • assembly string length
  • how to find length of string in assembly language
  • get length of string assembly
  • how to get the length of a string in assembly
  • how to find the length of a string in assembly
  • string length in assembly language
 
How to Count Lenght of a given string in assembly language- OUTPUT

No comments:

Complete Video Tutorials