Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

CSE 230 Arizona State University Assembly Language Program Project

CSE 230 Arizona State University Assembly Language Program Project

Question Description

I’m working on a c++ question and need a sample draft to help me study.

Objectives:

-write assembly language programs to:
-perform arithmetic on floating point numbers
-use syscall operations to display floating point numbers and strings on the console window
-use syscall operations to read floating point numbers from the keyboard.

Assignment Description:

Write a MIPS assembly language program that prompts for a user to enter how many floating point numbers to enter, then prompts to 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 should go through each element in the array to see which numbers are the smaller ones among them, and change them to 1000.0, and print them. After that, all numbers that are less than 1000.0 will be shifted to the beginning of the array resulting all 1000.0s will be shifted towards the end of the array, and it should print them again. Please see the given C program and the sample output to understand how it works.
Consult the green sheet and the chapter 3 for assembly instructions for floating point numbers. Here is one instruction that you might use:

c.lt.s $f2, $f4
bc1t Label1

Here if the value in the register $f2 is less than the value in $f4, it jumps to the Label1. If it should jump when the value in the register $f2 is NOT less than the value in $f4, then it should be:

c.lt.s $f2, $f4
bc1f Label1

To load a single precision floating point number (instead of lw for an integer), you might use:

l.s $f12, 0($t0)

To store a single precision floating point number (instead of sw for an integer), you might use:

s.s $f12, 0($t0)

To assign a constant floating point number (instead of li for an integer), you might use:

li.s $f12, 123.45

To copy a floating point number from one register to another (instead of move for an integer), you might use:

mov.s $f10, $f12

The following shows the syscall numbers needed for this assignment.

System Call System Call System Call
Number Operation Description

2 print_float $v0 = 2, $f12 = float number to be printed
4 print_string $v0 = 4, $a0 = address of beginning of ASCIIZ string
6 read_float $v0 = 6; user types a float number at keyboard; value is stored in $f0
8 read_string $v0 = 8; user types a string at keybd; addr of beginning of string is stored in $a0; len in $a1

——————————————

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

——————————————

int main( ) {    int howMany = 0, arraysize = 12, length;    float array[arraysize];    int i = 0, j = 0;    float num, temp;    printf("Specify how many numbers should be stored in the array (at most 12):n");    scanf("%d", &howMany);    //find the smaller number    if (arraysize < howMany)      length = arraysize;    else      length = howMany;   //this loop is to read in multiple numbers from a user    //and store them in an array   while (i < length)    {        printf("Enter a number:n");        scanf("%f", &num);        array[i] = num;        i++;    }       //print out the array conent    printf("The array contains the following:n");   i = 0;   while (i < length)      {        printf("%fn", array[i]);        i++;      }    for (i = 0; i < length/2; i++)     {      int index = 0;      for (j = 0; j < length; j++)      {        if(array[index] > array[j])         {          index =j;         }      }      array[index] = 1000.0;    }   //print out the array conent    printf("The array currently contains the following:n");   i = 0;   while (i < length)      {        printf("%fn", array[i]);        i++;      }    j = -1;    for(int i = 0; i < length; i++){      if(array[i] < 1000.0){        j = j+1;        temp = array[j];        array[j] = array[i];        array[i] = temp;      }    }   //print out the array conent    printf("The result array contains the following:n");   i = 0;   while (i < arraysize && i < howMany)      {        printf("%fn", array[i]);        i++;      }    return ; }

——————————————

Here are sample outputs (user input is in bold): — note that you might get some rounding errors.

——————————————–

Specify how many numbers should be stored in the array (at most 12):
8
Enter a number:
1.2
Enter a number:
-12.4
Enter a number:
53.3
Enter a number:
-12.4
Enter a number:
5.5
Enter a number:
53.3
Enter a number:
-12.4
Enter a number:
7.2
The array contains the following:
1.200000
-12.400000
53.299999
-12.400000
5.500000
53.299999
-12.400000
7.200000

The array currently contains the following:

1000.000000

1000.000000

53.299999

1000.000000

5.500000

53.299999

1000.000000

7.200000

The result array contains the following:

53.299999

5.500000

53.299999

7.200000

1000.000000

1000.000000

1000.000000

1000.000000

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Executive Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Executive Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Executive Papers is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Executive Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.