Question

In this part of the assignment, you will write MIPS assembly code to replace characters in...

In this part of the assignment, you will write MIPS assembly code to replace characters in a string.

This program asks the user for a string named string and two characters orig and new. It then replaces each instance of the character orig found in string with the character new. It outputs the resulting string and the number of substitutions that were made. For example, if string were "wow", orig were 'w', and new were 'b', the program would output the resulting string of "bob" and 2 as the number of substitutions.

this is a MIPS programming problem.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:-

li $t1,0 la $50, string lb $51,orig lb $s2,new #count #string base address #orig #new FOR_LOOP: lb $t2,($s0) beq $t2,$0, LOOP

Note: Could you please consider my effort on this work and give UPVOTE. Thank you :)

Add a comment
Know the answer?
Add Answer to:
In this part of the assignment, you will write MIPS assembly code to replace characters in...
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
  • 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...

  • MIPS programming question Problem 1: Write a program that asks the user to input a string...

    MIPS programming question Problem 1: Write a program that asks the user to input a string (or no more than 50 characters). Your program should then output the length of the string. The string length should be determined using a separate function strlen that will accept the address of the string and return its length. For the purposes of this exercise, the length of a string will be defined as the number of non-null and non-newline characters until either the...

  • MIPS Programming Assignment 4 (logical operations) Please write a complete MIPS assembly language programs for the...

    MIPS Programming Assignment 4 (logical operations) Please write a complete MIPS assembly language programs for the following questions and print a hardcopy of your code to submit 1. Swap each pair of elements in the string "chararn be an even number of characters in "chararray". (see loop4.a) 2 "numbers" is an array of five words. Catculate the sum of aftetements in "number muttiples of 4. Use the and instruction, not div or remfor thisquestion(S 3. "number" is a word. Write...

  • MIPS ASSEMBLY PROGRAM: PLEASE Write in MIPS Assembly language. Take strings as input and calculate and...

    MIPS ASSEMBLY PROGRAM: PLEASE Write in MIPS Assembly language. Take strings as input and calculate and print a simple checksum for each string. Make your string long enough to hold 50 characters. Don't forget to leave space for the null byte. Our checksum algorithm will produce a value which you can print with the syscall for printing a character. Stop reading strings when the user enters ".". The syscall to read a string (sycall code 8) adds a newline to...

  • MIPS Assembly Language * Write a simple program to count the number of non overlapping repetitions...

    MIPS Assembly Language * Write a simple program to count the number of non overlapping repetitions of a character pattern in a character string. For example " the pattern "aa" appears twice in the in the string "aabbaaa". Provide a user interface to read the character pattern and the string.

  • Write the Java code for the class WordCruncher. Include the following members:

    **IN JAVAAssignment 10.1 [95 points]The WordCruncher classWrite the Java code for the class WordCruncher. Include the following members:A default constructor that sets the instance variable 'word' to the string "default".A parameterized constructor that accepts one String object as a parameter and stores it in the instance variable. The String must consist only of letters: no whitespace, digits, or punctuation. If the String parameter does not consist only of letters, set the instance variable to "default" instead. (This restriction will make...

  • In Java, write a program that prompts the user to input a sequence of characters and...

    In Java, write a program that prompts the user to input a sequence of characters and outputs the number of vowels. You will need to write a method to return a value called isAVowel which will return true if a given character is a vowel and returns false if the character is not a vowel. A second method, called isAConstant, should return true if a given character is a constant and return false if the character is not a constant....

  • Your assignment is to write an assembly language program which read a string and print it in...

    Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the user to enter a string which is subsequently displayed in uppercase. It is important to first ensure that string to be converted is in the a-z range. The program does not recognize any space, symbols or any kind of punctuation marks. Any time the user enters any of this character the program is going to repeatedly ask for the...

  • Write a program that replace repeated three characters in a string by the character followed by 3...

    Write a program that replace repeated three characters in a string by the character followed by 3. For example, the string aabccccaaabbbbcc would become aabc3ca3b3cc. When there are more than three repeated characters, the first three characters will be replaced by the character followed by 3. You can assume the string has only lowercase letters (a-z). Your program should include the following function: void replace(char *str, char *replaced); Your program should include the following function: void replace(char *str, char *replaced);...

  • write programs with detailed instructions on how to execute. code is java What you need to...

    write programs with detailed instructions on how to execute. code is java What you need to turn in: You will need to include an electronic copy of your report (standalone) and source code (zipped) of your programs. All programming files (source code) must be put in a zipped folder named "labl-name," where "name" is your last name. Submit the zipped folder on the assignment page in Canvas; submit the report separately (not inside the zipped folder) as a Microsoft Word...

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
ADVERTISEMENT