Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to check whether the input string is a valid identifier or not.

Posted By: Luiginw Fischer     Category: Assembly Language     Views: 4423

Write a program to check whether the input string is a valid identifier or not. (Note: string starting with digit is not valid)

Code for Program to check whether the input string is a valid identifier or not. in Assembly Language

DIS MACRO STR
MOV AH,09H
LEA DX,STR
INT 21H
ENDM
DATA SEGMENT
    MSG1 DB "ENTER THE STRING : $"
    MSG2 DB "STRING IS NOT VALID $"
    MSG3 DB "STINRG IS VALID $"
    STR1 DB 20 DUP('$')
    LINE DB 10,13,'$'
DATA ENDS

CODE SEGMENT
        ASSUME DS:DATA,CS:CODE
START:
        MOV AX,DATA
        MOV DS,AX
        DIS MSG1
        MOV AH,0AH
        LEA DX,STR1
        INT 21H
        DIS LINE
        LEA SI,STR1+2
        MOV AL,'0'
        CMP BYTE PTR[SI],AL
        JL L2
        MOV AL,'9'
        CMP BYTE PTR[SI],AL
        JG L2
        DIS MSG2
        JMP L1
    L2: DIS MSG3   
    L1: MOV AH,4CH
        INT 21H
CODE ENDS
END START

;------
;OUTPUT
;------


    ENTER THE STRING : JINESH
    STINRG IS VALID

    ENTER THE STRING : 9JINESH
    STRING IS NOT VALID

    ENTER THE STRING : GA34
    STINRG IS VALID
  
Share: 



Luiginw Fischer
Luiginw Fischer author of Program to check whether the input string is a valid identifier or not. is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!