Write a MIPS assembly language program that prompts the user to input two string
ID: 2084735 • Letter: W
Question
Write a MIPS assembly language program that prompts the user to input two strings (each should be no longer than 50 characters including the null terminator). Your program should determine whether the second string is a substring of the first. If it is, then your program should print out the first index in which the second string appears in the first.
For example, if the first string is “Hello World” and the second string is “lo”, then the program should print out 3, i.e. the starting index of “lo” in “Hello World.” If the second string is not contained in the first string, then your program should print out -1.
Please include comments as assembly language is extremely hard to follow without them and this is only an intro class. Thank you!
Explanation / Answer
.data
theString:
.space 64
.text
main:
li $v0, 8
la $a0, theString
li $a1, 64
syscall
jr $ra
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.