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]
2 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]2 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
On the Direct Marketing worksheet, create appropriate range names for Design Fee (cell B8), Cost Per Ad (cell B9), Total Clicks
Inessa [10]

Answer:

See explanation below

Explanation:

Named ranges are a very important tool in Microsoft Excel. It is used in assigning a name to a particular number of cells. It is great for automation and makes formula much easy to understand and use.

One way to create named ranges is theory the Name Box.

To create named ranges in the design marketing sheet we do this;

1) We click on cell B8 and then navigate to the name box at the top right corner of the sheet just above the column A.

•The name box is where the cell address of any cell that is active is displayed.

•You would see that “B8” is displayed on the name box.

• Double click on the name box and type in the appropriate name, in this case - Design_Fee.

• Press enter and you have your named range.

You do the same for the other named ranges.

Note that: Named ranges must contain letters, numbers or underscore.

4 0
3 years ago
How do multi-cellular organisms develop?
FromTheMoon [43]
Letter B. is the answer
<span>B.  Cell differentiation - start from a single cell and as the cells divide they become specialized</span>

HOPE THIS HELPS















4 0
3 years ago
The part of the eye thats similar to the film of a camera is the
Lapatulllka [165]
The retina is the part pf the eye that is similar to the film of a camera. It is a thin layer of cells that is located at the back of the eyeball. This part contains photoreceptor cells which respond to light where the neural signals received undergoes complex processing by other neurons in the retina.
3 0
2 years ago
Which of the following is an example of constructive criticism for a friend who speaks too softly?
Dmitry [639]
C is correct..

Please vote my answer branliest! Thanks.
8 0
3 years ago
Read 2 more answers
I need help 50 points and brainless if you answer
nata0808 [166]

Answer:

50

var X gets passed into the rectangle function, which I assume would set the x and y coordinates to what the var's have already been set to.

4 0
2 years ago
Read 2 more answers
Other questions:
  • A page-replacement algorithm should minimize the number of page faults. We can achieve this minimization by distributing heavily
    14·1 answer
  • Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each number by a space.
    7·1 answer
  • Which of the following is an Internet supervisory protocol? O DNS IP O both A and B O neither A nor B
    12·1 answer
  • !WILL MARK BRAINLIEST!
    8·1 answer
  • Moore's Law postulates that:This task contains the radio buttons and checkboxes for options. The shortcut keys to perform this t
    6·1 answer
  • In relation to data science,advances in technology has made it more feasible to do what
    5·1 answer
  • Describe advantages and disadvantages for microprocessor controlled devices in the household.
    7·1 answer
  • Var1 = 1<br> var2 = 2<br> var3 = "3"<br> print(var1 + var2 + var3)
    5·1 answer
  • Assume there is a 30-byte heap. The free list for this heap has two elements on it. One entry describes the first 10-byte free s
    15·1 answer
  • Why would researching the average earnings by major and by career be useful to you as you choose an institute for higher educati
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!