CSC263 Computer Organization & Architecture II
Lab 1

 

In this lab you will read numbers into an array of ints. You will copy the even ints into one array and the odd ints into another array.

Create three arrays of ints in your data segment. The input array, an array for the even ints, and an array for the odd ints. Make each array large enough to hold 25 ints.

  1. Prompt the user to enter odd and even ints and to enter 0 when finished.
  2. Read the user input into your input array. Keep track of the number of ints entered. You can assume that the user will not enter more than 25 numbers.
  3. Copy all even values in the input array into the array of evens.
  4. Copy all odd values in the input array into the array of odds.
  5. Print a heading and then print the array of evens, printing a newline between each array element. Only print the array elements that that contain even numbers from the input, don't automatically print all 25 elements.
  6. Print a heading and then print the array of odds, printing a newline between each array element. Only print the array elements that that contain odd numbers from the input, don't automatically print all 25 elements.

Do not use array names in your code. You may use string names in la instructions.

Make sure your program includes comments. You need comments at the top with your name and lab number, and comments for every line of executable code (one comment is sufficient for all statements required for a syscall). Include an explanation of how each register is used.

Comments should reflect the purpose of a statement, not just repeat the instruction. For example, write a comment like

        addi      $t4, $t4, 4           # calculate addr of next array element

rather than

        addi      $t4, $t4, 4           # add 4 to $t4


Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2023