Logo 
Search:

Assembly Language Articles

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

Program to find a character in a string

Posted By: Abel Fischer     Category: Assembly Language     Views: 5889

Write a Program to find a character in a string.

Code for Program to find a character in a string in Assembly Language

stack segment
stack ends

data segment
        str1 db 'Assemblers$'
    
        msg1 db 'found$'
        msg2 db 'not found$'
data ends

ptrf macro msg
  lea dx,msg
  mov ah,09h
  int 21h
endm

code segment

        assume cs:code,ds:data,ss:stack

  start:
      mov ax,data
      mov ds,ax


  main proc near
        cld
        mov cx,10
        mov al,'A'
        lea di,str1

        repne scasb
        jne notfound
        ptrf msg1

 close:
        mov ax,4c00h
        int 21h

 notfound:
        ptrf msg2
        mov ax,4c00h
        int 21h

  main endp
 code ends

   end start
  
Share: 


Didn't find what you were looking for? Find more on Program to find a character in a string Or get search suggestion and latest updates.

Abel Fischer
Abel Fischer author of Program to find a character in a string 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!