ECE347 Lab Project – Stack and Passing Data to Subroutines 1. Start with a MAIN program, which initializes an ARRAY of 10 8-bit arbitrary numbers and reserves space for another 10-element array called...

ECE347 Lab Project – Stack and Passing Data to Subroutines 1. Start with a MAIN program, which initializes an ARRAY of 10 8-bit arbitrary numbers and reserves space for another 10-element array called EVENS. Then create subroutines as described below. MAIN should call all subroutines in the order shown in this description, then execute an infinite loop with some NOPs. 2. Subroutine EVEN_CNT counts the number of even array elements. The total element count for the source array (10) is passed using register A. The address of the source array is passed using register X. The count of even elements is returned in register B. Upon returning, MAIN should save the B value, as it may be needed later in the program. 3. Subroutine COPY_EVEN copies all the even array elements to the array called EVENS. The addresses of the source and target arrays are passed on the stack. The number of elements to scan (10) is passed on the stack. 4. Subroutine EVEN_AVE calculates the average of EVEN elements. The source array address and number of even elements is passed on the stack. The average is returned in a "stack hole." If the number of even elements is 0, the subroutine should exit immediately upon detecting this. Upon returning, MAIN should store the average value that was returned from EVEN_AVE. Test your code and document your results for the following cases: case A: seven even elements, three odd elements case B: all odd elements, no even elements This is an official lab in which a professional report is to be turned in. Include in your single pdf file an MSPEC, PCODE, unit test plan, and clearly documented test results for all test cases. The test results can be captured by using the SNIP tool on Code Warrior debugger memory display or variable window. Make sure your documentation is clear and easy to read.

May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here