Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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 return

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

What Is A Database And How Do I Use It

Authors: Matt Anniss

1st Edition

1622750799, 978-1622750795

Students also viewed these Databases questions