Logo 
Search:

Assembly Language Articles

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

Program to enter two strings, Find the characters that match in both the strings, store this character and display them at center of screen

Posted By: Ellis Evans     Category: Assembly Language     Views: 4978

Write an assembly program to enter two strings,
Find the characters that match in both the strings, store this character and display them at center of screen.

Code for Program to enter two strings, Find the characters that match in both the strings, store this character and display them at center of screen in Assembly Language

.model small

.data

        Param LABEL BYTE
        MaxLen db 7
        ActLen db ?
        KeyIn db 7 dup(' ')

        cntr db 2
        Str1 db 2 dup(7 dup(' '))
        ofset dw 0000
        ans db 5 dup(' ')

.code
        mov ax,@data
        mov ds,ax
        mov es,ax

        Main PROC Near
          mov ax,0
          L1:
                mov ah,0Ah
                LEA DX,Param
                int 21h

                mov bh,00
                mov Bl,ActLen
                mov KeyIn[BX],'$'

                mov BX,ofset
                mov cx,7
                LEA SI,KeyIn
                LEA DI,Str1[BX]
                rep MOVSB
                add ofset,7

                mov cx,7
                LEA SI,KeyIn
                L2:
                        mov  BYTE PTR [SI],20h
                        add SI,1
                        Loop L2
                sub cntr,1
                cmp cntr,00
                jne L1


                mov SI,0000
                mov BX,0000
                L3:
                        mov ah,str1[SI]
                        mov DI,0006
                        mov cx,7
                        L4:
                                inc DI
                                cmp ah,str1[DI]
                                je  store
                                Loop L4
                                INC SI
                                cmp SI,7
                                jl L3
                                jmp show

                                store:
                                        mov ans[BX],ah
                                        add BX,1
                                        INC SI
                                        cmp SI,7
                                        jl L3

                show:
                        mov ofset,BX
                        CALL ClearScreen
                        CALL SetCur

                        mov BX,ofset
                        mov ans[BX],'$'
                        mov ax,00
                        mov ah,09h
                        LEA DX,ans
                        int 21h

        mov ax,4C00h
        int 21h
       Main EndP

ClearScreen PROC Near
        mov ax,0600h
        mov bh,30h
        mov bl,00
        mov cx,0000
        mov dx,184FH
        int 10h
        ret
ClearScreen EndP



SetCur PROC Near
        mov al,00
        mov ah,02h
        mov bl,00
        mov Bh,00
        mov dx,0C27H
        int 10h
        ret
SetCur EndP
                                                                                                               
end
  
Share: 



Ellis Evans
Ellis Evans author of Program to enter two strings, Find the characters that match in both the strings, store this character and display them at center of screen is from London, United Kingdom.
 
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!