Logo 
Search:

Assembly Language Articles

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

Program to create a table consisting of roll no and the corresponding name, input a roll no through keyboard and then display the corresponding

Posted By: Walda Fischer     Category: Assembly Language     Views: 46475

A Program to create a table consisting of roll no and the corresponding name, input a roll no through keyboard and then display the corresponding name by searching from the table. Display appropriate message if Roll No. does not exists.

Code for Program to create a table consisting of roll no and the corresponding name, input a roll no through keyboard and then display the corresponding in Assembly Language

.MODEL SMALL
    .DATA
            VALIN     DB   4 dup(' '),'$'
            NL        DB   0DH,0AH,'NAME:','$'
            TAB_LEN   EQU  9
            TAB_NO    EQU  2
            TAB_DESC  EQU  7
            NB        DB   0DH,0AH,'OOPS NO MATCH','$'
            STUD_TBL  DB  '18','PINKY'
                      DB  '20','ASHISH'
                      DB  '21','TANMAY'
                      DB  '29','POOJAN'
                      DB  '39','SIYA'
                      DB  '40','NISHA'
                      DB  '42','JIGNA'
                      DB  '53','POOJA'
                      DB  '56','NEEL'
                      DB  '58','DHAVAL'
            STR1      DB      8      DUP(' '),'$'
            NL1       DB 'ENTER NO:','$'
    .CODE
    MAIN    PROC
        
            MOV AX,@DATA
            MOV DS,AX
            MOV ES,AX
            LEA DI,VALIN
            LEA DX,NL1
            MOV AH,09H
            INT 21H
    AGAIN:
            MOV AH,01H
            INT 21H
            CMP AL,0DH
            JE LBL1
            MOV [DI],AL
            INC DI
            JMP AGAIN

    LBL1:
            MOV AL,'$'
              MOV [DI],AL
    
            LEA DI,STUD_TBL
            CLD
    LBL2:
            MOV CX,2
            LEA SI,VALIN
            REPE CMPSB
            JE  LBL3
            JB  LBL5
            ADD DI,CX
            ADD DI,TAB_DESC
            JMP LBL2
    LBL3:
            MOV AH,09H
            LEA DX,NL
            INT 21H
            MOV DX,00
            ADD  DI,CX
            LEA SI,STR1
            MOV     CX,7
    DISPLAY:
            MOV AL,[DI]
            MOV [SI],AL
            INC   SI
            INC   DI
            LOOP DISPLAY
           LBL4:
            LEA     DX,STR1
            MOV     AH,09H
            INT     21H
            MOV AH,4CH
        INT 21H
    LBL5:
            MOV AH,09H    
            LEA DX,NB
            INT 21H
                   MOV AH,4CH
            INT 21H

    MAIN    ENDP
            END  MAIN




OUTPUT
***********

ENTER NO:02
OOPS NO MATCH
C:\tasm>ex02
ENTER NO:21
NAME:abc
C:\tasm>ex02
ENTER NO:20
NAME:xyz
  
Share: 



Walda Fischer
Walda Fischer author of Program to create a table consisting of roll no and the corresponding name, input a roll no through keyboard and then display the corresponding is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

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

 
Mai Lin from Philippines Comment on: Mar 10
it is not working..

View All Comments