Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer the question in full! If you can get this correct, then you are am

ID: 670299 • Letter: P

Question

Please answer the question in full! If you can get this correct, then you are amazing!!! Thanks so much in advance!!!!

GOAL: Write a program in MIPS assembly language that takes a set of signed 32-bit integers (words) as the input, classifies them into odd and even numbers, and then sorts the odd numbers and even numbers, respectively.

The input set integers are read from the console and the output sorted numbers are also in displayed in the console. For the input, a “special value” 9999 will be used to signify the end of the input sequence and this value is not to be considered part of the input data set. However, any value greater than 9999 that is entered prior to 9999 is considered as a valid input. Zero and negative values are also valid. All odd-number sets and all even-number sets are also valid.

The output sorting result should be in ascending order.

Example:

If the user inputs the values 15, 2, -9, 76, 45, 9999

The output in the console will be:

Sorted even numbers: 2, 76

Sorted odd numbers: -9, 15, 45

The input can be read in from the console one by one (with “ENTER” key after each input number) until “9999” is entered. The input set cannot be empty. You can use the following line to set up memory to hold the input:

.data
vals: .space 4000

Explanation / Answer

Hi,

I have written a sample code for the most complex part that getting an input from user and storing it into arrag , perform sorting and displaying it the output. For even and odd :-

You need to and the number which you want to check with 0x01.

This is how you use and in mips: and $d, $s, $t

If the value in target register is 1 then it is odd else even.

just make two array for one odd and even and do the required chages in the sample code for the complete code.