CIS 351

Assembly Loops

Winter 2022

For this lab, you are going to write and test some assembly code using loops. As with previous assignments, in order for your solution to work with my testing software, you must follow these rules:

You must also write a reasonably complete set of unit tests.

Problems

1. int indexOf(int value, int[] array)
Return the index of the first element of array that is equal to value, or return -1 if value doesn't appear in array. For this problem, a negative value will mark the end of array.
2. int max(int[] array, int length)
Return the largest value in array.
3. sum13(int[] array, int length) from CodingBat.
4. sum67(int[] array, int length) from CodingBat.
5. void reverse(char[] string)
Reverse string in place. string will be null-terminated. Hint: Set up two pointers, one to the first character, one to the last. Then "walk" the pointers toward the middle swapping as you go.
6. void evenOdd(int[] array, int length)
Re-arrange array in place such that all the even numbers come before all the odd numbers. The numbers may be in any order, so long as the evens come before the odds. This problem is based on the evenOdd CodingBat problem; however, unlike the CodingBat problem, you are not allowed to write data outside of the array.

You may use this class as a starting point for your MUnit tests.

Submission and grading

Use this GitHub Classroom repository. Place your code in loops1.asm. Do not rename the methods. The repo also has a file you can use as the starting point for your MUnit tests.

Be sure to document and comment your code!

When your code passes all tests, commit your code with [Grade Me] in the message.


Updated Tuesday, 8 February 2022, 3:11 PM

W3c Validation