Question
Write a MIPS Assembly Language Code for the following: Write a MIPS program to allow users to enter a string, which might be up to
Write a MIPS Assembly Language Code for the following:
Write a MIPS program to allow users to enter a string, which might be up to 64 byte long, via I/O window, and is saved to array X. The inputted string is then copied array X to array Y. You can manipulate the following procedure.
Note that the procedure assumes address of x is in $a0, and y in $a1.
Your program should loop so that users can enter a new string without re-assembling the program. So After one string copy is done ask the user to enter another string.
Code in MIPS Assembly Language Only Please
strcpy: addi $sp, $Ssp, -4 # adjust stack for 1 item # save $s0 so, $zero, $zero # 1 =0 LI: a addr ot y in $t 1bu $t2, o(St1) add $t3, $s0, $a0 sb $t2, o(St3) beq $t2, $zero, L2 addi $s0, # addr of x[i] # in $t3 x[i] = y[1] # next iteration of loop # restore saved Ss0 # pop 1 item from stack 1 addi Ssp, Ssp, 4 ra and return strcpy: addi $sp, $Ssp, -4 # adjust stack for 1 item # save $s0 so, $zero, $zero # 1 =0 LI: a addr ot y in $t 1bu $t2, o(St1) add $t3, $s0, $a0 sb $t2, o(St3) beq $t2, $zero, L2 addi $s0, # addr of x[i] # in $t3 x[i] = y[1] # next iteration of loop # restore saved Ss0 # pop 1 item from stack 1 addi Ssp, Ssp, 4 ra and returnStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started