subject

Assignment Description:

An array of integers can be assigned to a memory address in the .data section of a MIPS assembly language program as show below. Here the length of the array is stored first, and then the elements of the array numbers next. You are given the following C program that will ask a user to enter one integer and it will filter all integers in the array into the ones that are less than or equals to the entered integer and the ones that are greater. Implement a MIPS assembly language program to perform the functionality of the following C program and print the updated array content, by listing each integer in it.
For instance, if a user enters 5, then the output will be the following:
-42
3
-6
-18
-27
-28
11
45
12
24
35
14

i. e., the number that are less than 5,
(-42, 3, -6, -18, -27, -28) are swapped so that they are located towards the beginning of the array,
and the number that are greater than 5,
(11, 45, 12, 24, 35, 14) are located towards the end of the array.
If your program causes an infinite loop, press Control and 'C' keys at the same time to stop it. Name your source code file assignment5.s.

.data
numbers_len: .word 12
numbers: .word -42, 11, 24, 3, -6, 14, -18, 45, 12, -27, 35, -28

The following shows how it looks like in a C program:

void main()
{
int numbers[12] = {-42, 11, 24, 3, -6, 14, -18, 45, 12, -27, 35, -28};

int num1, num2;
int i = -1;
int j;

printf("Enter an integer:\n");

//read an integer from a user input and store it in num1
scanf("%d", &num1);

for (j = 0; j < 12; j = j+1)
{
if (numbers[j] <= num1)
{
i = i + 1;
num2 = numbers[i];
numbers[i] = numbers[j];
numbers[j] = num2;
}
}

for (j = 0; j < 12; j = j+1)
{
printf("%d\n", numbers[j]);
}

return;
}

The following is a sample output (user input is in bold):

Enter an integer:
5
-42
3
-6
-18
-27
-28
11
45
12
24
35
14



The following is another sample output:



Enter an integer:
-20
-42
-27
-28
3
-6
14
-18
45
12
11
35
24

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 10:50
Your friend kayla is starting her own business and asks you whether she should set it up as a p2p network or as a client-server network. list three questions you might ask to kayla decide which network to use and how her answers to those questions would affect your recommendation.
Answers: 2
question
Computers and Technology, 24.06.2019 17:00
Carlos, an algebra teacher, is creating a series of powerpoint presentations to use during class lectures. after writing, formatting, and stylizing the first presentation, he would like to begin writing the next presentation. he plans to insert all-new content, but he wants to have the same formatting and style as in the first one. what would be the most efficient way for carlos to begin creating the new presentation? going under the file tab and opening the first presentation, deleting all content from each page, and adding new content going under the file tab and clicking on new in the left pane, then choosing new from existing going under the design tab and clicking on themes, then selecting the theme that was used for the first template going under the design tab and opening the template that was created for the first presentation
Answers: 2
question
Computers and Technology, 24.06.2019 22:00
Iam trying to get my google account back for school and business, can someone ?
Answers: 1
question
Computers and Technology, 24.06.2019 22:50
Which of these might be an example of an advertiser's target group? a.people who have no access to media b.people the advertisers know nothing about c. people who watch a variety of tv shows d. people who live in the same region of the country
Answers: 2
You know the right answer?
Assignment Description:

An array of integers can be assigned to a memory address in the...
Questions
question
Spanish, 22.05.2020 13:59
question
Chemistry, 22.05.2020 13:59
question
Mathematics, 22.05.2020 13:59
Questions on the website: 13722363