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

WRITE PROGRAM IN ASSEMBLY LANGUAGE (MIPS) Write a program that returns the media

ID: 641050 • Letter: W

Question

WRITE PROGRAM IN ASSEMBLY LANGUAGE (MIPS)

Write a program that returns the median, the number of positive integers, negative integers, and zeros in an array of integers. The size of the array is not fixed. The final element of the array should have the value 0xF, which is not used for the calculations and should be counted for the size. Display those numbers with appropriate message on the console output. For example, assume an array as follows:

array: .word 12, 2, -4, 16, 5, -20, 0, 10, 0xF

Use MIPS and please post screenshot if you can, I will give you a 5 star rating.

Explanation / Answer

$v0 = 0;

$v1 = 0;

for ( ; $a1 > 0; $a1 = $a1-1)

{$t0 = Mem($a0);

$t1 = $t0 & 1;

$a0 = $a0 + 4;

if ($t0 > 0 & $t1 = 0) $v0 = $v0 + $t0;

if ($t0 < 0 & $t1 != 0)   $v1= $v1+ $t0;

}

return;