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
netineya [11]
3 years ago
10

Write a MIPS assembly language program that prompts for a user to enter how many floating point numbers to enter, then prompts t

o enter a series of floating point numbers and reads in numbers and store them in an array, then prints the original content of the array. Then it repeats it for a second array, and compare numbers from two arrays, and if a number in the first array is larger than the number of the second array of the same index, it swaps them. Then it should print the result contents for both arrays.
Computers and Technology
1 answer:
Natalija [7]3 years ago
5 0

Answer:

See explaination

Explanation:

.data

arraysize: .word 10

counter: .word 1

alreadystored: .word 0

num: .space 40 # reserve 40 bytes from the starting address of array

inputmsg: .asciiz "Enter a floating point number:\n"

outputmsg: .asciiz "The array contains the following numbers: \n"

.text

.globl main

main:

lw $t1, counter #counter

lw $t2, arraysize #max length of array

la $t0, num # base address of the array

#set initial flag for duplicate array element 0=entered value not present in array,1= entered value exists in array

li $t3,0 #reset the flag for alreadystored to 0

Loop 1:

# print input message prompt

la $a0, inputmsg

li $v0, 4

syscall

# get user entered keyboard input

li $v0, 6

syscall

# move user entered value from $f0 to array base address

s.s $f0, 0($t0)

#load the value at address pointed by $t0 to register $f1

l.s $f1,0($t0)

#compare the entered value in register $f0 to the value stored in $f1

c.eq.s $f1,$f0

#jump to loop2 if the values are not equal ie if the entered value is not duplicate then increment the array index and compare with next array element

bc1f loop2

#else make the value of flag alreadystored =1

li $t3,1

# if no duplicate then move to the next position in the array, increment loop counter

loop2:

addi $t0, $t0, 4

addi $t1, $t1, 1

ble $t1, $t2, Loop1

# reset loop counter, and array address for printing out the array elements

lw $t1,counter

la $t0, num

# print output message prompt

la $a0, outputmsg

li $v0, 4

syscall

print_array:

# print array elements

l.s $f12, 0($t0)

li $v0, 2

syscall

# print space

la $a0, 32

li $v0, 11

syscall

# increment loop counter and move to next array element

addi $t1, $t1, 1

addi $t0, $t0, 4

ble $t1, $t2, print_array

#Exit

li $v0,10

syscall

You might be interested in
B) What is system software? Write its importance.​
NNADVOKAT [17]

Answer:

System software is software designed to provide a platform for other software. Examples of system software include operating systems like macOS, Linux, Android and Microsoft Windows, computational science software, game engines, search engines, industrial automation, and software as a service applications.

Explanation:

5 0
2 years ago
Universal Containers requires that all users add at least one Product Option from the Maintenance Feature to a bundle.
zmey [24]

Answer

Set the Max Options for “Maintenance” to be one. Set the Min Options to one & Max Options to two for “Support”.

Explanation:

the Admin set up these requirements for the user using Set the Max Options for “Maintenance” to be one. Set the Min Options to one & Max Options to two for “Support”. Since users must select at least one and no more than two Product Options from the Support Feature and Product Option from the Maintenance Feature to a bundle.

6 0
3 years ago
Yo, my Lenovo laptop keeps showing this screen but I can't sign in, can someone help me?
rusak2 [61]
Break your laptop and get a new one
8 0
3 years ago
Read 2 more answers
Son opciones de configuración espacio multimedia llamado blog
Softa [21]

NSaAnswer:

th

Explanation:

nks

6 0
3 years ago
Maria works for MegaCorp, a large privately owned company specializing in sales of ball bearings. MegaCorp introduces filtering
ololo11 [35]

Answer:

No, because it would be generally free for private-sector employees by using filtering software to restrict access to some websites.

Explanation:

Maria working for the following Corporation, a major private-owned company that specializes throughout ball bearings production. That corporation establishes filtering software to restrict access to some of these sites linked to non-work, and also some sites with poπnographic images.

So, Maria could not challenge that policy lawfully, as private-sector employees are usually free to always use filtering software to restrict access to some of these Websites

3 0
3 years ago
Other questions:
  • What procedures are involved in saving a file for the first time?
    10·2 answers
  • When configuring a vpn server to automatically assign ​ip addresses to remote clients, how many ip addresses are in a single poo
    10·1 answer
  • There are 55 registers, and total 60 instructions available in a general-purpose computer. The computer allows only 2-address in
    6·1 answer
  • The Internet may best be compared to a/an
    11·1 answer
  • Which of the following is NOT one of the Big 3 Google Applications that we discussed?
    9·2 answers
  • There are ___ Federal Reserve Banks. Each bank is also in charge of its assigned District Banks.
    10·1 answer
  • Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the stateme
    15·1 answer
  • Which is not one of the four criteria for proving the correctness of a logical pretest loop construct of the form: while B do S
    14·1 answer
  • Calculate the total and average number from 1 to 100<br>​
    12·1 answer
  • Demons I shall be your eternal nightmare
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!