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
What is the ghosted text or picture behind the content on the page?​
Svetach [21]

Answer:

Watermark

Explanation:

This is actually called a Watermark. It is usually used as a way of showing the name or logo of the author who owns the content that is underneath the watermark. This is done so that individuals cannot steal the owner's work and use it as their own. Usually, the owner has the original version of the content without any watermark, as well as individuals that have purchased the content or a licence to use the content for personal or commercial usage.

3 0
2 years ago
3.
gulaghasi [49]

Explanation:

the process of displaying the information from the table is called query

<h2>hey friend </h2><h2>your answer is here </h2><h2>I hope it will be helpful you </h2><h2>please mark as brainiest answer </h2><h2>thank you </h2>
7 0
2 years ago
Jason Chang is creating photos of his restaurant for a new website. Some of the photos of the staff have red eye, others are bad
Nadusha1986 [10]

It is okay to modify photos digitally to improve their appearance as long as it doesn't show what they aren't producing.

<h3>What is Advertisement?</h3>

This is the act of persuading people to buy goods and services and is usually done with the aid of the media.

Pictures are usually taken which have to be in the best shape and quality in order to entice people to buy the goods thereby bringing about higher sales and profit for the company.

Read more about Advertisement here brainly.com/question/1020696

7 0
2 years ago
What is a disadvantage of shopping online?A.Harder to compare prices than in storesB.A higher risk of financial data theftC.More
babymother [125]

.A higher risk of financial data theftC

7 0
2 years ago
Read 2 more answers
A good way to assess your CPU usage is to:_______.
inna [77]
C is likely the best answer here.
8 0
3 years ago
Other questions:
  • Extend the flow properties and definitions to the multiple-source, multiple- sink problem. Show that any flow in a multiple-sour
    13·1 answer
  • Which represents the hierarchical structure of a Google Analytics account from top to bottom?
    5·1 answer
  • What are the methods of identifying publicly switched networks?
    14·1 answer
  • Write a function ngrams(n, tokens) that produces a list of all n-grams of the specified size from the input token list. Each n-g
    6·1 answer
  • Intelligence is to creativity as _____ is to _____. Group of answer choices spatial intelligence; musical intelligence correct t
    15·1 answer
  • Write a list comprehension statement to generate a list of all pairs of odd posi
    7·1 answer
  • The ability to understand a person's needs or intentions in the workplace is demonstrating
    5·1 answer
  • What is the output?
    7·1 answer
  • 100 POINTS!!!!!!!
    15·2 answers
  • Which technology keeps track of heart rate during a workout? (3 points) bathroom scale calculator pedometer wrist monitor
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!