CIS 351 |
Assembly Loops |
Fall 2018 |
For this homework, 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:
.globl
.a0
, a1
, and a2
.
a0
will contain the first parameter, a1
the second, etc.
jr $ra
.1
for true
and 0
for false
.int indexOf(int value, int[] array)
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
.
int max(int[] array, int length)
array
.
void reverse(char[] string)
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.
void evenOdd(int[] array, int size)
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.
When your code passes all tests, submit the
.asm
and test files using Blackboard's Assignment Manager. Your
grade is based on when your code passes all tests. If your code
passes all tests by the due date, you get 100%. Otherwise, you lose
5% for each day it takes you after the due date to submit correct
code. In addition, you lose 5% for each incorrect submission. For
example, if your first submission is two days late, but completely
correct, your score will be 90%. If you submit incorrect solutions
on the due date, and then submit the correct solutions two days
later, your score will be 85%.
Updated Saturday, 20 October 2018, 7:20 PM