Question

Assembly Programming INCLUDE Irvine32.inc Make a program that takes a string and a word as inputs...

Assembly Programming

INCLUDE Irvine32.inc

Make a program that takes a string and a word as inputs from the user and searches
the word in the string. If it finds the word in the string, it prints “ Found”, else it prints “ Not
found”. Note that i t is not searching for the matching characters but searching for the
corresponding word. For example, suppose a string is “I am a teacher.” and a word for
search is “tea”. Now the string has four words; I, am, a, teacher. Now the searched word,
“tea” is not there. So, your program has to say, Not found”.


An example for your program is shown in below box .
NOTE:
1. The string length does not exceed 40 characters.
2. ‘Enter’ character (<ent>) is not counted in string length.
3. If input string is larger than 40 characters, ignore the string and get input again.
4. You can freely define procedures in your convenience.
5. Input Enter character (<ent>) to finish the program.

Type_A_String: I like MUSIC
A_Word_for_Search: MUSIC
Found
Type_A_String: I am a student
A_Word_for_Search: stud
Not found
Type_A_String: I like MUSIC ..↲
A_Word_for_Search: MUS
Not found
Type_A_String:
Bye!

0 0
Add a comment Improve this question Transcribed image text
Answer #1
.stack 200h

.data

message1 db "Enter the text here: $"
text db 150,151 dup(0)
message2 db 10,13,"Enter the word that you want to find: $"
find db 20,21 dup(0)
yesmessage db 10,13,"Found$"
nomessage db 10,13,"Not found$"

.code
Start:

;Display message and key in strings
mov ax,seg message1
mov ds,ax

mov si,offset text
mov di,offset find

mov dx,offset message1
mov ah,09h
int 21h

mov dx,si
mov ah,0Ah
int 21h

mov ax,seg message2
mov ds,ax

mov dx,offset message2
mov ah,09h
int 21h

mov dx,di
mov ah,0Ah
int 21h

;compare strings
mov bx,00

mov bl,text+1
mov bh,find+1

cmp bl,bh
jne L1

add si,2
add di,2

L2:mov bl,byte ptr[si]
cmp byte ptr[di],bl
jne L1
inc si
inc di
cmp byte ptr[di],"$"
jne L2
mov ah,09h
mov dx,offset yesmessage
int 21h
L1:mov ah,09h
mov dx,offset nomessage
int 21H

mov ax,4c00h
int 21h
end start
Add a comment
Know the answer?
Add Answer to:
Assembly Programming INCLUDE Irvine32.inc Make a program that takes a string and a word as inputs...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Java program that reads a word and prints its bigrams substrings. A character bigram...

    Write a Java program that reads a word and prints its bigrams substrings. A character bigram is defined as a continuous sequence of two characters in a word. For example, if the user provides the input "rum", the program prints ru um Hint: 1. set two pointers, one always moves from the beginning of the string and the other moves from i+2, in which i is the current position of the first pointer. 2. print an error message if the...

  • Write a program that can remove spaces from an input string, find the indexes of a...

    Write a program that can remove spaces from an input string, find the indexes of a character within the string and replace that character with another character. Here is an example input: I am an input string a b The first line, "I am an input string" represents the input string. Please put it into a string variable using getline. In the second line "a b", a is the character that needs to be located within the input string, and...

  • Using C++ programming. Write a program that takes a string of input from the user and...

    Using C++ programming. Write a program that takes a string of input from the user and separates the string of words based on the premise that the string contains words whose first letter is uppercase. Then, display the phrase (or sentence) to a string in which the words are separated by spaces and only the first word of the phrase starts with an uppercase letter. For example, if the user enters "IAmTheTeacher", then the program would display: "I am the...

  • Write a program in PYTHON that takes a string and an integer as inputs from the...

    Write a program in PYTHON that takes a string and an integer as inputs from the user, and then prints a new string that contains the letters from the original string “rotated” by the given amount. For example, “cheer” rotated by 7 places gives the word “jolly” and “melon” rotated by -10 gives the word “cubed.” Use built-in function: ord() to convert a character to a numeric code and chr() to convert numeric code to character.

  • 2. Searching a String: Write a MIPS assembly language program to do the following: Read a...

    2. Searching a String: Write a MIPS assembly language program to do the following: Read a string and store it in memory. Limit the string length to 100 characters. Then, ask the user to enter a character. Search and count the number of occurrences of the character in the string. The search is not case sensitive. Lowercase and uppercase letters should be equal. Then ask the user to enter a string of two characters. Search and count the number of...

  • Write a Python function called more() that takes three string inputs and outputs a string Formally,...

    Write a Python function called more() that takes three string inputs and outputs a string Formally, the function signature and output are given by rucharist, char: str words str) > str Use the same names for the input arguments as shown above Note that charl and char2 will always be a string of length 1 (ie, it is a single character. The function checks which of charl or char2 appears more often in the word string and returns that character...

  • This program asks the user to enter a word. It then tries to create a string...

    This program asks the user to enter a word. It then tries to create a string with the minimum number of repetitions of the word necessary to make a string of length at least 20. Right now, it ends up making too long of a string in certain cases. For example, if you enter a word with eight letters, like "computer", the result should only have three copies of the word in order to meet the length requirement of 20:...

  • For this lab you will write a Java program that plays a simple Guess The Word...

    For this lab you will write a Java program that plays a simple Guess The Word game. The program will prompt the user to enter the name of a file containing a list of words. These words mustbe stored in an ArrayList, and the program will not know how many words are in the file before it starts putting them in the list. When all of the words have been read from the file, the program randomly chooses one word...

  • Write a Java program which takes a string as a user input. Create 2 functions. The...

    Write a Java program which takes a string as a user input. Create 2 functions. The first function expects a string as argument and returns void. It converts all upper case characters to lower case and converts all lower case characters to upper case. It then prints out the converted string to a console. The second function also expects a string as argument and returns void. It will find first charactor that is repeated exactly 2 times in the string....

  • Assembly program: NASM assembler write a program to print the location of character "i" from a input string from left to right. User inputs a strings upto 40 characters.

    Assembly program: NASM assembler write a program to print the location of character "i" from a input string from left to right. User inputs a strings upto 40 characters.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT