1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Arlecino [84]
3 years ago
6

4-Translate the following C program to MIPS assembly program (Please explain each instruction in your code by a comment and subm

it a .asm file) int main() { char Str1[6]= {'h','e','l','l','o','\0'}; char Str2[5]= {'m','a','r','s','\0'}; int i, j; i = 0; while( Str1[i]!='\0') { i++; } j = 0; while( Str2[j]!='\0') { Str1[i] = Str2[j]; i++; j++; } Str1[i] = '\0'; printf("\n String after the Concatenate = %s", Str1); return 0; }
Computers and Technology
1 answer:
earnstyle [38]3 years ago
3 0

Answer:

.data

str1: .asciiz "Hello"

str2: .asciiz "mars"

msg: .asciiz "String after the concatenate: "

.text

main:

#load the address str1 to $a0

la $a0,str1

#initialize $t0 with 0

li $t0,0

#loop to find the length of str1

#$t0 stores the length of str1

loop1:

#load byte of $a0 to $t1

lb $t1,0($a0)

#branch for equal.If $t1 equal to 0,jump to label stop1

beq $t1,0,stop1

addi $t0,$t0,1 #increase the count

addi $a0,$a0,1 #increase the address

#jump to label loop1

j loop1

stop1:

#load the address of str2 to $a1

la $a1,str2

#loop2 concatenate the each element in str2 to str1

loop2:

lb $t2,0($a1) #load character in str2 to $t2

sb $t2,0($a0) #store value in $t2 to str1

beq $t2,0,stop2

addi $a1,$a1,1 #increase the address of str2

addi $a0,$a0,1 #increase the address of str1

j loop2

stop2:

#syscall for print string is $v0 = 4

#syscall to termiante the program is $v0 = 10

#print the message

li $v0, 4

la $a0, msg

syscall

#print the concatenated string

li $v0,4

la $a0,str1

syscall

#termiante the program

li $v0, 10

syscall

Explanation:

You might be interested in
Case 2-2 Jack has a computer at home that he uses to access the Internet, store and edit personal photos, and create and edit do
bekas [8.4K]

Answer:

Check button under error checking

Explanation:

Under the Tools tab there are two options:

Error checking and Optimize and defragment drive option.

clicking the check button with administrative permission under error checking option will examine the hard drive for errors.

3 0
3 years ago
More than 700 people in the United States have been infected with monkeypox virus American vector: the epidemic is spreading lik
erik [133]

An epidemic that is spreading like a snowball is one that is that is moving in a gradual or seasonal rate.

<h3>What is snowball spread of virus?</h3>

An epidemic is said to be spreading like a snowball if  it is said to be moving at a rate.

Note that in the case of monkey virus, the epidemic that is spreading like a snowball is one that is that is moving in a gradual or seasonal rate.

Learn more about epidemic  from

brainly.com/question/15452937

#SPJ1

5 0
2 years ago
What is the shortcut key to apply /remove the subscript effect?<br> Ctrl+=<br><br> Ctrl-+
telo118 [61]

Answer:

Press "Ctrl, "Shift" and "=" on your keyboard to turn off superscript formatting.

5 0
3 years ago
What tells the hardware what to do and how to do it?
oksano4ka [1.4K]

Answer:

I think its CPU

Explanation:

8 0
3 years ago
You found an image on the Creative Commons that you would like to use. How do you give credit to the author? *
Archy [21]
You need to write the author’s name
7 0
3 years ago
Read 2 more answers
Other questions:
  • Identify which portion of the below host IP addresses are invalid and explain why it is invalid. Hint: If you aren't sure, conve
    12·1 answer
  • The ____ cell on the worksheet is the one into which you can enter data.â
    15·2 answers
  • "The fact that we could create and manipulate an Account object without knowing its implementation details is called"
    9·1 answer
  • The data manipulation language (DML) of SQL contains SELECT, INSERT, DELETE, and UPDATE statements, whereas the data definition
    12·1 answer
  • In order to view the permissions assigned to each type of user for all the files located in a directory, which of the following
    12·1 answer
  • Tawni made some changes to her file and wants to save the changes in a document with a different title. How can she do this?
    14·2 answers
  • Companies increasingly want to allow employees to share files directly without having to maintain servers to provide FTP access.
    5·1 answer
  • Hi wanna play fortnite tomorrow add me im batjoker09 no caps or spaces
    13·1 answer
  • A program that is used to view websites is called a​
    13·2 answers
  • I’m not very good at using word because this is my second time using it lol
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!